typescript throws error when you want to initialize an arrow function that returns different objects based on overloaded string literal union type #55606
Labels
Duplicate
An existing issue was already created
π Search Terms
arrow function
union
overload
π Version & Regression Information
all TS versions
β― Playground Link
https://www.typescriptlang.org/play?ts=5.2.2#code/PTAEDsHsCcFsEMA2oBmBXcBjALgS0uKJAG4Cm0ik8AJqAO4wDWAzvaYogIQBQ36WeAqGylm2ABTEAXACIAFu0oyAlFIDeCjpCng0sAEbkAvgG4+GHPkIixk2XNwr1DqfsiREpeOFO9zAq2FRbFA7UDFoXHAAc2U1blBQXBRJUABeDNB5RUgVeMTE6FJsNGhCDRypAEYAJgBmX0SjdmZSUCKSstANXClsaDRSI25hkHbi0vAAFQBPAAc23FZMGCKcTjMbCWytFTNuMew5aEg6VnIT6CTCeGgTulQLQXAebmx5tpJyShp07oSCnYdkpVBUtDo9IZoI1AdJ5I5QS43B4vD4zE0AQCVuAxEExDUpF8KFRaGlQsRlGkAHz5JIpYjpTLA3JxAGFCZdMGUar1GHNRCtcadcoufqDYYYg5gDqTWYLJLLVakdbovHYGriZl7IA
π» Code
π Actual behavior
typescript throws error when you want to initialize an arrow function that returns different objects based on overloaded string literal union type.
π Expected behavior
TS most not throws error in this case as it does not throws error in normal function
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: