Type alias OmitByType<T, P>

OmitByType<T, P>: {
    [K in Keys<T> as T[K] extends P
        ? never
        : K]: T[K]
}

Get a set of properties from T whose type are not assignable to P.

Type Parameters

  • T
  • P

Example

type T = {
foo: string,
bar: bigint | boolean,
baz: number,
}
OmitByType<T,true>; // Result: T
OmitByType<T,number>; // Result: { foo: string, bar: bigint | boolean }