type predicate-ness lost when using Function.prototype.bind #29531
Labels
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Experience Enhancement
Noncontroversial enhancements
Help Wanted
You can do this
Suggestion
An idea for TypeScript
Milestone
TypeScript Version: 3.2.4 or @next as of 2019-01-22
Search Terms:
Code
Expected behavior:
Compiles.
Actual behavior:
Error message:
What seems to be happening is that the type predicate-ness of Array.isArray is lost when .bind is used. I tested with a few type predicate functions, and always get the same error.
Playground Link:
Not reproducible on playground, because it depends on a higher TS version.
In the playground, the type of the RHS is
any
, so there is no compilation error.Related Issues:
Typings for
Function.prototype.bind
were discussed in bind(), call(), and apply() are untyped #212 but I couldn't find any mention of type predicates.Discussion on StackOverflow
The text was updated successfully, but these errors were encountered: