-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issue
Description
TypeScript Version: (maybe 2.1.x - typescriptlang.org playground version as of 2017-1-2)
Code
typescriptlang.org playground
[1, 2, 3].map(mapper); // fine???
[1, 2, 3].map((obj, idx) => mapper(obj, idx)); // <= error
type Tag = number & { _tagBrand: any; };
function mapper<E>(obj: E, type: Tag) {
return obj;
}
Expected behavior:
The first map()
call on line 1 should throw the same compile error as the second call, since the second parameter of the mapper function does not match the second parameter of the function expected by Array.map()
Actual behavior:
No compile error on the first map() call when it should.
Found while working on nominal types based on basarat's git book 'Nominal Typings' section.
Reproduced in VS 2015 update 3 TypeScript 2.1.4 and the typescriptlang.org playground.
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issue