-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Understand Node's assert()
as a type guard
#19622
Labels
Duplicate
An existing issue was already created
Comments
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TypeScript Version: 2.5.3
Code
For code like below:
, typescript understand that
a
is non-null when returned fromgetFoo()
.But Node.js has its own
assert
module, and it is not understood by typescript and we need a type-cast like below:It'd be really great if typescript understands that the non-nullness has been already checked by the
assert()
call anda
is non-null in this case.The text was updated successfully, but these errors were encountered: