Skip to content

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
@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