-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.4.0
Code
The following blows up nicely as expected:
type A = {
foo: string;
};
/** 'baz' does not exist in type 'A' */
const test1: A[] = [{ foo: 'foo', baz: 42 }];
Put it through the map
method though, and any extra fields will be silently accepted:
/** no error */
const test2: A[] = ['foo'].map(val => ({ foo: val, baz: 42 }));
Expected behavior:
Both examples blow up w/ 'baz' does not exist in type 'A'
Actual behavior:
Only the compilation of the first example fails.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created