镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Description

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.

Activity

  1. RyanCavanaugh commented on Feb 6, 2016

    @RyanCavanaugh
    Member

    This is a good idea

  2. weswigham commented on Feb 8, 2016

    @weswigham
    Member

    #6196 should fix this, right?

  3. vlad-shatskyi commented on Feb 8, 2016

    @vlad-shatskyi
    Author

    Yes, Wesley Wigham (@weswigham). Closing this issue.

  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions