-
Notifications
You must be signed in to change notification settings - Fork 2
weird behavior of TypeScript on assignment operators #9
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
Comments
Sure, check for duplicate issues and then open one. I wonder if |
Seems not possible for TypeScript.
According to ECMA, at least for the example code above, their semantics should be equivalent. The difference is mostly about pattern matching (e.g. |
Issue opened: microsoft/TypeScript#60520 and microsoft/TypeScript#60521. Actually, I realized that they are two separate issues, because the last two function in the code example is not about operators performing narrowing, rather |
Good news: maintainer quickly noticed they are duplicate-ish issues |
Look at the following code:
Summary:
+=
behaves differently from their expanded equivalent likex = x + ...
on type narrowing, though they should be equivalent (at least for the given examples)Part of the code is taken from this issue.
Maybe we should open an issue at TypeScript's repo.
The text was updated successfully, but these errors were encountered: