Skip to content

unique symbol from the same source text position via multiple construction should be incompatible #48736

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

Closed
Jack-Works opened this issue Apr 17, 2022 · 1 comment

Comments

@Jack-Works
Copy link
Contributor

Bug Report

πŸ”Ž Search Terms

unique symbol

πŸ•— Version & Regression Information

Tested on 4.7.0

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare let cond: boolean
function z() {
    const a = Symbol()
    return { a: a } as const
}
let x = z()
let y = z()

// Expected Error: Type 'typeof a' is not assignable to type 'typeof a'. Two different types with this name exist, but they are unrelated.
if (cond) {
    x = y
} else {
    y = x
}
export {}

πŸ™ Actual behavior

No type error

πŸ™‚ Expected behavior

Type 'typeof a' is not assignable to type 'typeof a'. Two different types with this name exist, but they are unrelated.

@whzx5byb
Copy link

Duplicate of #40106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants