-
-
Notifications
You must be signed in to change notification settings - Fork 571
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
Rename Omit
#27
Comments
I find |
The another option is |
@CvX I don't like having to prefix types with |
Alright. We'll go with |
Relevant discussion: microsoft/TypeScript#31205 |
Since we're renaming this anyway, maybe we should name it |
As far as I understand the type, it will already exclude multiple properties when used with a union type:
will omit properties |
While I wish they would have stayed consistent with what the community already understands as the behavior of |
I think I like |
I'm also not convinced we need a second word in the type name. Something like |
I did not realize that. We should definitely document that better. |
@andyfleming Yeah, I like your argument about consistency. But shouldn't it be |
@sindresorhus I think the verbalized version of it makes sense as singular, specifically because of the union type. let obj: ExcludeKey<ObjectType, "a" | "b">
|
We may also want to consider if we should avoid using the word |
How about reducing it to a single word 'Except'? Then it's readable, understandable and I believe has no conflicts with wording. let obj: Except<ObjectType, 'a' | 'b'> |
Alright. Let's go with |
We managed to convince the TS team to add
Omit
as a built-in type, unfortunately, they added a loose version, not what we suggested, and they insist on staying with it.The great thing about user-land code is that we can fix their dumb decisions.
However, that does mean our
Omit
type will conflict with the native one... But I guess that gives us the opportunity to come up with a better name for it.I never really found
Omit
that clear. How aboutExcludeProperty
orExcludeKey
? I prefer the former. Open to other suggestions.The text was updated successfully, but these errors were encountered: