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 unionsTypeScript省略(具体为排除)不适用于具有“任何”索引类型的对象,并破坏区分的并集

Type Parameters

  • TRecordOrUnion

  • KeyUnion

Generated using TypeDoc