-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 narrowing of string literal seems to get loosened in callbacks #14748
Comments
Use |
That sort of makes sense (though this is just a sample, the real code I noticed it on is most definitely not a constant). Wouldn't it be better to annotate things that are definitely not asynchronous to prevent this spurious warning? |
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.2.1
Code
Expected behavior:
No warnings: the value (and type) of
str
has not changed.Actual behavior:
Warning
Argument of type 'string' is not assignable to parameter of type '"value"'.
The text was updated successfully, but these errors were encountered: