Skip to content

Limit when we allow nested unique symbols to be serialized #40886

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

Conversation

weswigham
Copy link
Member

to when their declaration is within the same file as the context. Within the same context, the symbol should be referred to by typeof declname (or be the declaration unique symbol node itself), so this should be sufficient.

Fixes #40786

…eir declaration is within the same file as the context
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Oct 1, 2020
export const A: AX = 0 as any;
==== tests/cases/compiler/b.ts (1 errors) ====
import { A } from './a';
export const A1 = A;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why couldn’t it just serialize as typeof A (or typeof import('./a').A if the import gets erased) here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I said as why in the issue, but I'll restate it here: because that could only work for specific patterns of assignments, and while we may carve out syntactic patterns for checking JS, we do not for TS. So because it doesn't generalize beyond var x = entity.name assignments to all assignments, it doesn't make sense to do, really.

@weswigham weswigham merged commit 77df9fa into microsoft:master Oct 5, 2020
@weswigham weswigham deleted the error-on-anonymous-type-with-nonlocal-unique-symbol branch October 5, 2020 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"unique symbol" is generated to multiple .d.ts files
4 participants