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
interfaceI{x: number|null;}functiongeneric<TextendsI>(a: T,b: Partial<T>){if(a.x!=null){a.x.toFixed(2);// OK}if(b.x!=null){b.x.toFixed(2);// ERROR: Property 'toFixed' does not exist on type 'T["x"]'}}functionnotGeneric(a: I,b: Partial<I>){if(a.x!=null){a.x.toFixed(2);// OK}if(b.x!=null){b.x.toFixed(2);// OK}}
Expected behavior:
The mapped generic code should compile without error.
Actual behavior:
The mapped generic code does not compile.
For context, the place I'm seeing this issue is React when interacting with props. The React typings for a Component are:
TypeScript Version: 2.3.4
Code
Expected behavior:
The mapped generic code should compile without error.
Actual behavior:
The mapped generic code does not compile.
For context, the place I'm seeing this issue is React when interacting with
props
. The React typings for aComponent
are:The text was updated successfully, but these errors were encountered: