You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think for this to work TS would need to infer type arguments from indexed access types, but it doesn't. This isn't considered a bug but a missing feature, which is possibly implemented at #20126 and/or #53017, neither of which have been merged.
The feature needed here is the more complex "Given a set of parameter types, produce what an equivalent call expression would have done". ReturnType<F> is definitely not that.
π Search Terms
"Generic Type","Function","Parameters","ReturnType"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAKhDOwbmgXigbwFBSgQwC5MdcoBjAewBsKAnIxWgSwDsBzAbhIF8vcAjItlJR+dACYR6URq048uvLFkotE5PFSrwo6YRq1xEQkrhZ4AthCIByMpqpHgNgDSmoAMwCuLMkQA8MFAQAB7AECziOgDWECAUHrAISCgAfAAU0UQwAJS6qcQiuLQQwF60LJjc+DpOyJAA2jAAunyk3G64HVhKWKCQUADCDjp6JA0A0lCsULHxif0QCQbazSYi5lZEE2243r5Ei8v2WvCTzQ02+2Q2rQo9XFiSZFR4JZ4+ZMBMFJUnVABlYDMdhQQLBMIRKKzOLLYanFxQABiEPCkR08O0TQuV0+twyJAAjrQQERMWcWpdNhBbp0oAA6RlvNjwIgABTellKUng-iRqSwOSIACVSuUWPUIHyBcpVOoSvAvFRgLoVkCQWx0nYHE5XFAbHgbDVyL9EDkgA
π» Code
π Actual behavior
result
type is{color: string} | {border: string}
. The type of the returned result is not mapped to the parameterπ Expected behavior
result
type is{color: string}
. The type should map to parameter 'a'Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: