In the following code snippet:
type WithOr = {a:string} & ({b?:true, c?:never} | {b?:false, c:number})
type Ommited = Omit<WithOr, 'a'>
const m1: Ommited = {b: true};
const m2: WithOr = {...m1, a: 'a'}
An error will be encountered:
Type 'boolean | undefined' is not assignable to type 'false | undefined'.
...
The issue appears to be related to Omit not handling the "or" logic correctly.
Is there an alternative approach to reusing a complex type using Omit (with "or" conditions) without completely redefining it?
For more information, check out this playground link.