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
export{};typeReturnType<Textends(...args: any[])=>any>=Textends(...args: any[])=> infer R ? R : any;typeReturnTypeReturnType<Textends(...args: any[])=>(...args: any[])=>any>=ReturnType<ReturnType<T>>;typeExpected=ReturnType<ReturnType<()=>()=>"abcdef">>;// correctly `"abcdef"`typeActual=ReturnTypeReturnType<()=>()=>"abcdef">;// `never`constx: Actual="abcdef";// Error
Expected behavior:
Actual same as Expected.
Actual behavior:
Actual is never.
The issue may be fixed by changing the definition of ReturnType to be T extends (...args: any[]) => infer R ? R : never;. Based on the rules in #21496 the behavior with any may be by design, but the global ReturnType definition currently uses any, so maybe the fix should be in lib.d.ts.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.8.0-dev.20180216
Search Terms: ReturnType conditional type
Code
Expected behavior:
Actual
same asExpected
.Actual behavior:
Actual
isnever
.The issue may be fixed by changing the definition of
ReturnType
to beT extends (...args: any[]) => infer R ? R : never;
. Based on the rules in #21496 the behavior withany
may be by design, but the globalReturnType
definition currently usesany
, so maybe the fix should be inlib.d.ts
.The text was updated successfully, but these errors were encountered: