TypeScript Version: Nightly, 3.7.5
Search Terms: excess property, computed property
Code
consta=<T>(shape: T|(()=>T)): T=>{returnshapeinstanceofFunction ? shape() : shape;}//Case 1a<{x: string}>(()=>({x: '',o: ''}));// I expect this to fail//Case 2a<{x: string}>({x: '',o: ''});// Fails as expectedExpected behavior:
I expect Case 1 to show error similar to Case 2 because returned object contains more properties than described in generic type.
Actual behavior:
Case 1 is a valid typescript
Playground Link:Playground Link
TypeScript Version: Nightly, 3.7.5
Search Terms: excess property, computed property
Code
Expected behavior:
I expect
Case 1to show error similar toCase 2because returned object contains more properties than described in generic type.Actual behavior:
Case 1is a valid typescriptPlayground Link:Playground Link