stack

Home > @infiniteobjects/type-utils > Except

Except type

Create a type from an object type without certain keys.

Signature:

export type Except<ObjectType, KeysType extends keyof ObjectType> = {
    [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
};

Remarks

This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types microsoft/TypeScript#30825.