Sha256: 869121668002b9cf188bba1b107acd7ee744c9446e66a1449dbfcc5bca521f9d

Contents?: true

Size: 1015 Bytes

Versions: 33

Compression:

Stored size: 1015 Bytes

Contents

/**
Create a type from an object type without certain keys.

This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.

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](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).

@example
```
import {Except} from 'type-fest';

type Foo = {
	a: number;
	b: string;
	c: boolean;
};

type FooWithoutA = Except<Foo, 'a' | 'c'>;
//=> {b: string};
```

@category Utilities
*/
export type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.59 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.58 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.57 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.56 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.55 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.54 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.53 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.52 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.51 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.50 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.49 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.48 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.47 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.46 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.45 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.44 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.43 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.42 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts
immosquare-cleaner-0.1.41 node_modules/crypto-random-string/node_modules/type-fest/source/except.d.ts