Skip to content

Use 'Omit' instead of 'Pick<Exclude<...>>' for object rest - #31134

Merged
Ryan Cavanaugh (RyanCavanaugh) merged 5 commits into
microsoft:masterfrom
rpgeeganage:use_omit_instead_pick
Apr 30, 2019
Merged

Use 'Omit' instead of 'Pick<Exclude<...>>' for object rest#31134
Ryan Cavanaugh (RyanCavanaugh) merged 5 commits into
microsoft:masterfrom
rpgeeganage:use_omit_instead_pick

Conversation

@rpgeeganage

@rpgeeganage Ruwan Pradeep Geeganage (rpgeeganage) commented Apr 27, 2019

Copy link
Copy Markdown
Contributor

Trying to deliver the Modification mentioned in #30948

Fixes #30948

@rpgeeganage Ruwan Pradeep Geeganage (rpgeeganage) changed the title add Omit<T, ..> instead of Pick<Exclue<T>,..> Use 'Omit' instead of 'Pick<Exclude<...>>' for object rest Apr 27, 2019
@rpgeeganage

Copy link
Copy Markdown
Contributor Author

Nathan Shively-Sanders (@sandersn) ,
This is the PR for #30948.
Please give me feedback, regarding the modification.
Thank you.

@DanielRosenwasser

Copy link
Copy Markdown
Member

Seems like the change is probably good. Now run gulp baseline-accept to update the test outputs.

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

Daniel Rosenwasser (@DanielRosenwasser) ,
Thanks a lot for the feedback. I'll run it and update PR.

@DanielRosenwasser

Copy link
Copy Markdown
Member

Actually, I don't know if the change is appropriate because it will error if Omit isn't present. It's not clear if it should. There is a getGlobalTypeOrUndefined.

@DanielRosenwasser

Copy link
Copy Markdown
Member

Mm, team seems to think that maybe we shouldn't even have the fallback.

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

Daniel Rosenwasser (@DanielRosenwasser) ,
I'm sorry that I'm not clear about your comment. Can you please elaborate little bit if possible?

@rpgeeganage

Ruwan Pradeep Geeganage (rpgeeganage) commented Apr 29, 2019

Copy link
Copy Markdown
Contributor Author

Ok, I can modify the code as follows.

if (! omitTypeAlias) {
  return errorType;
}

return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);

and get rid of the code from line 4949 to 4955.

@msftclas

Microsoft Contribution License Agreements (msftclas) commented Apr 29, 2019

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@rpgeeganage

Ruwan Pradeep Geeganage (rpgeeganage) commented Apr 29, 2019

Copy link
Copy Markdown
Contributor Author

Daniel Rosenwasser (@DanielRosenwasser) ,
I changed the code. Can you please give me an insight on how can I fix the tests?
A sample error message is as follows.

The baseline file genericObjectRest.types has changed.
Error: The baseline file genericObjectRest.types has changed

@DanielRosenwasser

Daniel Rosenwasser (DanielRosenwasser) commented Apr 29, 2019

Copy link
Copy Markdown
Member

@rpgeeganage

Copy link
Copy Markdown
Contributor Author

Daniel Rosenwasser (@DanielRosenwasser) ,
Thanks. I fixed the tests\baselines\reference.

@RyanCavanaugh

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 30, 2019

Copy link
Copy Markdown
Contributor

Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the extended test suite on this PR at cf15c79. You can monitor the build here. It should now contribute to this PR's status checks.

@RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) merged commit 0c9a35c into microsoft:master Apr 30, 2019
@microsoft 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use 'Omit' instead of 'Pick<Exclude<...>>' for object rest

5 participants