-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Using Omit weakens type checking #46361
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
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
Comments
Looks like you want Omit to distribute over the union: See https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types |
You expect the omit type to operate distributive, but it doesn't. Look up "distributive omit". You should look at the definition of omit to understand how it works and why it behaves the way it does. |
I see. Thank you very much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
When using the
Omit
type, the type-checking does not catch some cases that it previously did.π Search Terms
Omit inaccurate
π Version & Regression Information
Test in both 3.3.3 and 4.5.0-beta.
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
When using the
Omit
type to exclude a single field, the type checking is weaker.π Expected behavior
When using
Omit
, the only difference should be that the field is excluded without any other side-effects or weaker typechecks.The text was updated successfully, but these errors were encountered: