Skip to content

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

Merged
Wesley Wigham (weswigham) merged 1 commit into
microsoft:masterfrom
weswigham:error-on-anonymous-type-with-nonlocal-unique-symbol
Oct 5, 2020
Merged

Wesley Wigham (weswigham) merged 1 commit into
microsoft:masterfrom
weswigham:error-on-anonymous-type-with-nonlocal-unique-symbol

Conversation

@weswigham

Copy link
Copy Markdown
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
export const A: AX = 0 as any;
==== tests/cases/compiler/b.ts (1 errors) ====
import { A } from './a';
export const A1 = A;

Copy link
Copy Markdown
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
Copy Markdown
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
Wesley Wigham (weswigham) merged commit 77df9fa into microsoft:master Oct 5, 2020
@weswigham
Wesley Wigham (weswigham) deleted the error-on-anonymous-type-with-nonlocal-unique-symbol branch October 5, 2020 18:59
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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