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
Seems there is not enough context for TS to infer R in some2, since you are not passing any argument with type R. You can fix this by explicitly telling TypeScript to infer R from the interface:
interfaceA<R>{a(): R}declarefunctionsome2<DextendsA<any>>(a: D): DextendsA<infer R> ? R : any;letout2=some2({a(){return'asd'}})// out2 is string!
TypeScript Version: 3.0.1, vscode 1.26.1
Search Terms:
Code
Expected behavior: out1:
string
, out2:string
Actual behavior: out1:
string
, out2:{}
Playground Link
The text was updated successfully, but these errors were encountered: