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

Don't widen unique symbol for different declarations #55943

Closed
wants to merge 2 commits into from

Conversation

jakebailey
Copy link
Member

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.

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.

Which is what @DanielRosenwasser hinted at.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 2, 2023
Comment on lines +1 to +2
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.
Copy link
Member Author

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
Copy link
Member Author

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.

@RyanCavanaugh
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 4, 2023

Heya @RyanCavanaugh, I've started to run the tarball bundle task on this PR at f632137. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 4, 2023

Hey @RyanCavanaugh, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/158089/artifacts?artifactName=tgz&fileId=F7153853B7D6F5D594DCF79391E2AE0F7D0F43ABAC1928C16C90E1A02229729502&fileName=/typescript-5.3.0-insiders.20231004.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.3.0-pr-55943-2".;

@jakebailey
Copy link
Member Author

referencing #55860 before I delete this branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unique symbol lost on assignment to const despite type assertion
3 participants