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
interfaceTestProps{foo: string;bar: string;}functiontest(mode: number,vars: TestProps): TestProps{switch(mode){case1:
return{foo: 'a',bar: 'b',other: 'c',// This is an error};case2:
return{
...vars,other: 'c',// This SHOULD be an error}}return{foo: 'a',bar: 'b',}}
Expected behavior:
The spread operator with an unknown attribute should show a type error.
Actual behavior:
The spread operator with an unknown attribute does not show a type error.
The text was updated successfully, but these errors were encountered:
This is a pretty big issue I've run into while using Redux, where all state changes require copying the object keys and overwriting a subset, just like case 2. I've had to make a special function that wraps Object.assign but catches unknown props.
TypeScript Version:
TypeScript 2.2.1
Code
Expected behavior:
The spread operator with an unknown attribute should show a type error.
Actual behavior:
The spread operator with an unknown attribute does not show a type error.
The text was updated successfully, but these errors were encountered: