-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version:
TypeScript 2.2.1
Code
interface TestProps {
foo: string;
bar: string;
}
function test(mode: number, vars: TestProps): TestProps {
switch (mode) {
case 1:
return {
foo: 'a',
bar: 'b',
other: 'c', // This is an error
};
case 2:
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.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created