Skip to content

Document assignment to aliasSymbol in getUnionTypeFromSortedList #17434

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

Merged
merged 2 commits into from
Sep 7, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jul 26, 2017

Replaces #17349

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

I suggested improved wording for one line.

@@ -7359,6 +7359,11 @@ namespace ts {
type = <UnionType>createType(TypeFlags.Union | propagatedFlags);
unionTypes.set(id, type);
type.types = types;
/*
Note: This is the alias symbol (or lack thereof) that we see when we first encounter this union type.
If there exist both `type T = number | boolean` and `type U = number | boolean`, it is arbitrary which one gets the aliasSymbol.
Copy link
Member

Choose a reason for hiding this comment

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

I would write this line as

For aliases of identical unions, eg type T = A | B; type U = A | B, the symbol of the first alias encountered is the aliasSymbol.

This is technically true even for the language server, but "first alias encountered" depends on the order of actions by the user.

@mhegazy mhegazy merged commit 508cde0 into master Sep 7, 2017
@mhegazy mhegazy deleted the aliasSymbol branch September 7, 2017 19:39
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants