Type alias EnhancedOmit<TRecordOrUnion, KeyUnion>

EnhancedOmit<TRecordOrUnion, KeyUnion>: string extends keyof TRecordOrUnion
    ? TRecordOrUnion
    : TRecordOrUnion extends any
        ? Pick<TRecordOrUnion, Exclude<keyof TRecordOrUnion, KeyUnion>>
        : never

TypeScript Omit (Exclude to be specific) does not work for objects with an "any" indexed type, and breaks discriminated unions

Type Parameters

  • TRecordOrUnion

  • KeyUnion

Generated using TypeDoc