-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type guards in Array.prototype.every #14963
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Help Wanted
You can do this
Milestone
Comments
It's not the same, though. |
@vkurchatkin Would adding the above declaration for |
@kylewlacy yes, I think so |
NaridaL
added a commit
to NaridaL/TypeScript
that referenced
this issue
Sep 10, 2017
…rd if the callback is one. Also made the type of thisArg generic. Fixes microsoft#14963
NaridaL
added a commit
to NaridaL/TypeScript
that referenced
this issue
Sep 10, 2017
…rd if the callback is one. Also made the type of thisArg generic. Fixes microsoft#14963
NaridaL
added a commit
to NaridaL/TypeScript
that referenced
this issue
Sep 10, 2017
…rd if the callback is one. Also made the type of thisArg generic. Fixes microsoft#14963
NaridaL
added a commit
to NaridaL/TypeScript
that referenced
this issue
Sep 11, 2017
…rd if the callback is one. Fixes microsoft#14963
NaridaL
added a commit
to NaridaL/TypeScript
that referenced
this issue
Sep 18, 2017
…rd if the callback is one. Fixes microsoft#14963
NaridaL
added a commit
to NaridaL/TypeScript
that referenced
this issue
Sep 19, 2017
…rd if the callback is one. Fixes microsoft#14963
related to #5101 |
#16069 now tracks inferring the type guard automatically. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Help Wanted
You can do this
TypeScript Version: 2.2.2
Code
Expected behavior:
When every member of
numberOfStrings
matches theisNumber
type guard, the whole array should be inferred to benumberOfStrings: number[]
; so, the above code should compile without error.Actual behavior:
The above fails to compile, with the following error:
This issue is similar to #7657, and it can be solved by adding something like the following to
lib.d.ts
:(or, the above can be added locally to a project as a temporary workaround)
The text was updated successfully, but these errors were encountered: