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

Allow indexing generics with unique symbols #22339

Merged
merged 2 commits into from
Mar 5, 2018

Conversation

weswigham
Copy link
Member

Fixes #22320

@@ -5948,7 +5954,7 @@ namespace ts {
// If the current iteration type constituent is a string literal type, create a property.
// Otherwise, for type string create a string index signature.
if (t.flags & TypeFlags.StringLiteral) {
const propName = escapeLeadingUnderscores((<StringLiteralType>t).value);
Copy link
Member

Choose a reason for hiding this comment

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

Since this is a StringLiteral, does this need to be changed? Is it just for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

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

Mostly, yeah. The function below is used up above in the same body and is the correct one to use for future support of symbols as mapped type keys.

getLiteralType(symbolName(prop));
const links = getSymbolLinks(prop);
if (!links.nameType) {
if (links.target && links.target.escapedName === prop.escapedName) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't have to check names 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.

Moved to debug assertion.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 8, 2018

I think you mean:

trie[letter][END_WORD] = END_VALUE;

instead of

trie[END_WORD] = END_VALUE;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants