You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A question: what's the difference between animals.filter(isCat) and animals.filter(a => isCat(a))? I thought the first one is a syntactic sugar for the second one, when there is only argument.
a => isCat(a) is a function literal expression that creates a new function. isCat is an identifier referring to an existing function. isCat has a type annotation declaring it to be a type predicate, but a => isCat(a) has no type annotations and relies on type inference. We will never infer a type predicate type, only boolean (#5101).
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.6.1
Code
Expected behavior:
No errors
Actual behavior:
Error at
cats2
:The first call to
filter
onanimals
resolves to the functionwhile the second call resolves to:
The text was updated successfully, but these errors were encountered: