🔎 Search Terms
"Generic Type","Function","Parameters","ReturnType"
🕗 Version & Regression Information
- This is a bug
- This changed between versions v5.6.0
⏯ Playground Link
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAKhDOwbmgXigbwFBSgQwC5MdcoBjAewBsKAnIxWgSwDsBzAbhIF8vcAjItlJR+dACYR6URq048uvLFkotE5PFSrwo6YRq1xEQkrhZ4AthCIByMpqpHgNgDSmoAMwCuLMkQA8MFAQAB7AECziOgDWECAUHrAISCgAfAAU0UQwAJS6qcQiuLQQwF60LJjc+DpOyJAA2jAAunyk3G64HVhKWKCQUADCDjp6JA0A0lCsULHxif0QCQbazSYi5lZEE2243r5Ei8v2WvCTzQ02+2Q2rQo9XFiSZFR4JZ4+ZMBMFJUnVABlYDMdhQQLBMIRKKzOLLYanFxQABiEPCkR08O0TQuV0+twyJAAjrQQERMWcWpdNhBbp0oAA6RlvNjwIgABTellKUng-iRqSwOSIACVSuUWPUIHyBcpVOoSvAvFRgLoVkCQWx0nYHE5XFAbHgbDVyL9EDkgA
💻 Code
typeTestType={a: {color: string;};b: {border: string;};};constcalls={callTest: {name: 'callTest',func: <TextendskeyofTestType>(k: T)=>{return{}asTestType[T];},},};typeCalls={[Kinkeyoftypeofcalls]: {name: K;func: typeofcalls[K]['func'];};};declareconstcallString=<TextendskeyofCalls,FextendsCalls[T]['func']>(qry: Calls[T]['name'],
...args: Parameters<F>): ReturnType<F>constresult=callString('callTest','a'asconst)🙁 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
🔎 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
resulttype is{color: string} | {border: string}. The type of the returned result is not mapped to the parameter🙂 Expected behavior
resulttype is{color: string}. The type should map to parameter 'a'Additional information about the issue
No response