Skip to content

The node builder should strive to preserve mapped type keyof-ness#23815

Merged
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:keyof-inference-equivalences
May 3, 2018
Merged

The node builder should strive to preserve mapped type keyof-ness#23815
weswigham merged 1 commit into
microsoft:masterfrom
weswigham:keyof-inference-equivalences

Conversation

@weswigham
Copy link
Copy Markdown
Member

Fixes #23583

getIndexType distributes over the intersection within PartialProperties in the example in the linked issue and simplifies one branch to a literal. In resolveMappedTypeMembers, we already have something known as the "modifiersType" that is used to work around this and similar problems (when calculating optionality and readonly-ness), so now we use that in the node builder when we want to try and preserve keyof-ness there, too.

@weswigham weswigham requested review from mhegazy and rbuckton May 1, 2018 23:10
@weswigham weswigham merged commit eb80e9a into microsoft:master May 3, 2018
@weswigham weswigham deleted the keyof-inference-equivalences branch May 3, 2018 19:38
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 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.

Declaration emit infers a different type when using keyof and Exclude

2 participants