-
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
Don't widen unique symbol for different declarations #55943
Conversation
uniqueSymbolsDeclarations.ts(104,7): error TS2527: The inferred type of 'constInitToLReadonlyType' references an inaccessible 'unique symbol' type. A type annotation is necessary. | ||
uniqueSymbolsDeclarations.ts(105,7): error TS2527: The inferred type of 'constInitToLReadonlyNestedType' references an inaccessible 'unique symbol' type. A type annotation is necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the cases this breaks an would need to be solved differently; perhaps we can detect this through visibility instead.
@@ -524,10 +524,10 @@ const o2 = { | |||
>s : unique symbol | |||
|
|||
method5(p = s) { return p; }, | |||
>method5 : (p?: symbol) => symbol | |||
>p : symbol | |||
>method5 : (p?: unique symbol) => symbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These kinds of changes don't make me happy and probably indicate that this change is probably not good as-is.
@typescript-bot pack this |
Heya @RyanCavanaugh, I've started to run the tarball bundle task on this PR at f632137. You can monitor the build here. |
Hey @RyanCavanaugh, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
referencing #55860 before I delete this branch |
Fixes #55901
This is mainly for discussion for now. It appears as though this case is needed in some cases, e.g. in
tests/baselines/reference/uniqueSymbolsDeclarations.errors.txt
.Which is what @DanielRosenwasser hinted at.