source: trip-planner-front/node_modules/type-fest/source/except.d.ts@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 886 bytes
Line 
1/**
2Create a type from an object type without certain keys.
3
4This 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.
5
6Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript.
7
8@example
9```
10import {Except} from 'type-fest';
11
12type Foo = {
13 a: number;
14 b: string;
15 c: boolean;
16};
17
18type FooWithoutA = Except<Foo, 'a' | 'c'>;
19//=> {b: string};
20```
21*/
22export type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
Note: See TracBrowser for help on using the repository browser.