Skip to content

Only include unique symbols when getting index types for access checks - #23145

Merged
Wesley Wigham (weswigham) merged 3 commits into
microsoft:masterfrom
weswigham:remove-symbols-from-keyof
Apr 5, 2018
Merged

Wesley Wigham (weswigham) merged 3 commits into
microsoft:masterfrom
weswigham:remove-symbols-from-keyof

Conversation

@weswigham

Copy link
Copy Markdown
Member

Alternative to #23090 that moves towards the indexof type we talked about the other day, but is lightweight enough to be more acceptable as a patch. Note that this only removes/fixes symbols - number literals from late bound symbols will still be an issue (though they've been an issue for longer and need to have more confusing behavior, so probably should wait for the full indexof implementation).

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.

Approved with the suggested change.

Comment thread src/compiler/checker.ts Outdated
}
else {
return getUnionType(filter(originalKeys, isTypeString));
}

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.

Just one line!

@mhegazy

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) please port to release-2.8 as well.

@weswigham
Wesley Wigham (weswigham) merged commit de669cf into microsoft:master Apr 5, 2018
@weswigham
Wesley Wigham (weswigham) deleted the remove-symbols-from-keyof branch April 5, 2018 17:59
Wesley Wigham (weswigham) added a commit to weswigham/TypeScript that referenced this pull request Apr 5, 2018
microsoft#23145)

* Only include unique symbols when getting index types for access checks

* Filter all nonstrings

* Inline ternary
@mhegazy Mohamed Hegazy (mhegazy) added this to the TypeScript 2.8.2 milestone Apr 5, 2018
Wesley Wigham (weswigham) added a commit that referenced this pull request Apr 5, 2018
#23145) (#23175)

* Only include unique symbols when getting index types for access checks

* Filter all nonstrings

* Inline ternary
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jul 25, 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