-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
bind() returns type 'any' and does not type check it's arguments. e.g.
var add = function (a: number, b: number) { return a + b; };
var addString = add.bind(null, 'hello');
compiles without error and 'addString' has type any.
bind is a default way to achieve partial application so it would be great to have it typechecked properly.
Similarly for apply, the code
var listA = [1, 2, 3];
var listB = ['a', 'b', 'c'];
listA.push.apply(listA, listB);
compiles without error and listA is still incorrectly marked as type 'number[]'.
call() example:
var add5 = function (a: number) { return 5 + a; };
add5.call(null, 'a string');
Again without a compiler error.
michaelmesser, interphx, dreamsunshine, fusepilot, normalser and 124 more
Metadata
Metadata
Assignees
Labels
FixedA PR has been merged for this issueA PR has been merged for this issueIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript