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

Util types for special Omit cases #1121

Merged
merged 6 commits into from
Jun 7, 2021
Merged

Util types for special Omit cases #1121

merged 6 commits into from
Jun 7, 2021

Conversation

Stephen-ONeil
Copy link
Contributor

As encountered here, using the built in Omit util on a something that has any index types on it will give an unexpected result... Although they say it's the expected behaviour regardless 🤷 .

Scrounged up a handful of useful util types from the various discussions of this issue. We'll probably want to use IndexTypeSafeOmit* pretty much anywhere we need to omit keys, since it doesn't have the fiddly gotcha of the built-in.

* names in this branch feel kinda awkward, would welcome any better suggestions!

@Stephen-ONeil
Copy link
Contributor Author

Stephen-ONeil commented Jun 4, 2021

Alternatively, and I haven't looked for this yet, there's probably libraries of util types out there already. I bet they'd cover the implementation of something like this for us. Preferable to import a package over maintaining these utils our self, they're a little tricky to read and don't have unit tests written for them here.

…fixed an edge case bug that I'd caught in IndexTypeSafeOmit and adds symbol support, nice
…r out of date prettier version doesn't understand
…Add util_types.d.ts to .prettierignore for now, will remove that line on the prettier 2.3 branch
@Stephen-ONeil Stephen-ONeil changed the title Util types for special Omit-like cases Util types for special Omit cases Jun 4, 2021
Copy link
Contributor

@ktw1016 ktw1016 left a comment

Choose a reason for hiding this comment

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

Will try it out on my branch👍

@Stephen-ONeil Stephen-ONeil merged commit 5bb5ca2 into master Jun 7, 2021
@Stephen-ONeil Stephen-ONeil deleted the ts-omit-utils branch June 7, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants