Closed
Description
Bug Report
π Search Terms
omit union
π Version & Regression Information
- This is the behavior in every version I tried since 3.5 where Omit was introduced, and I reviewed the FAQ for entries about omit
β― Playground Link
π» Code
type A = {
shared: string;
something: true;
exclusiveToA: string;
}
type B = {
shared: string;
something: false;
exclusiveToB: string;
}
type C = A | B;
type D = Omit<C, 'shared'>;
const a: D = {
something: true,
exclusiveToA: 'here',
}
const b: D = {
something: false,
exclusiveToB: 'here',
}
π Actual behavior
Omit
strips away properties of its union type operands that don't have common keys
π Expected behavior
Omit
should recursively distribute over union/product type expressions
Metadata
Metadata
Assignees
Labels
No labels