Skip to content
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

Strict Comparison Operator Doesn't Infer Singleton Types Correctly #6940

Closed
vlad-shatskyi opened this issue Feb 6, 2016 · 3 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@vlad-shatskyi
Copy link

Having a singleton type type A = "a" | "b", a variable const a: A = "a", and an expression a === "c", the compiler should infer the type of "c" as A and make the expression unsound.

Currently (1.8.0 and 1.9.0-dev.20160206) it compiles, which makes usage of singleton types instead of enums less type safe.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Feb 6, 2016
@RyanCavanaugh
Copy link
Member

This is a good idea

@weswigham
Copy link
Member

#6196 should fix this, right?

@vlad-shatskyi
Copy link
Author

Yes, @weswigham. Closing this issue.

@RyanCavanaugh RyanCavanaugh added Duplicate An existing issue was already created and removed In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Feb 8, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants