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
typeUnWrapValue<T>=TextendsArray<infer TValue> ? TValue|null : never;typeUnWrapObject<T>={[PinkeyofT]: UnWrapValue<T[P]>;};interfaceDefaultProps{prop1: number[];prop2: string[];}interfaceExtendedPropsextendsDefaultProps{prop3: boolean[];}classSuperKlass<T>{unwrapped!: UnWrapObject<T>;original!: T;}// It appears to me that the default generic type isn't being accounted for here.// I would expect T to be at least DefaultProps and and be able to get that typing, however, it // is unable to infer the typing.classSubKlass<TextendsDefaultProps=DefaultProps>extendsSuperKlass<T>{method1(){// Why does the typing NOT work here?this.unwrapped.prop1=1;}}classOneDeeperextendsSubKlass<ExtendedProps>{method2(){// Why does the typing work here?this.unwrapped.prop1=1;this.unwrapped.prop3=false;}}
🙁 Actual behavior
Unwrapping a constrained generic type with "infer" fails to do so properly.
🙂 Expected behavior
"this.unwrapped.prop1" should be type "string" within "SubKlass".
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
All versions have this problem.
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Unwrapping a constrained generic type with "infer" fails to do so properly.
🙂 Expected behavior
"this.unwrapped.prop1" should be type "string" within "SubKlass".