-
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
Present somehow to user that literal type is a widening literal type #11181
Labels
Suggestion
An idea for TypeScript
Too Complex
An issue which adding support for may be too complex for the value it adds
Comments
RyanCavanaugh
added
Suggestion
An idea for TypeScript
In Discussion
Not yet reached consensus
labels
Sep 27, 2016
I'm not sure this reduces net confusion, but we can consider it |
RyanCavanaugh
added
Too Complex
An issue which adding support for may be too complex for the value it adds
and removed
In Discussion
Not yet reached consensus
labels
Nov 15, 2016
It's not at all obvious what value this would provide -- anyone capable of understanding what that would mean probably wouldn't be confused in the first place, whereas anyone who doesn't know what |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Suggestion
An idea for TypeScript
Too Complex
An issue which adding support for may be too complex for the value it adds
I'm just adding the task here for your consideration (because it was buried in a comment in some other bug).
With #11126
we have now (literal types and widening literal types) and new rules to remember to understand the resulting inferred type for mutable location:
etc..
Now using this code:
so what I'm asking is - make it more clear for user to figure out why TS behaves in a way it behaves (because right now presenting
Type: a | b
for both cases is misleading and can cause some bugs (or rather prevent bugs from detecting)Maybe VSCode could show:
Thanks a lot for consideration
The text was updated successfully, but these errors were encountered: