source: trip-planner-front/node_modules/type-fest/source/merge.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: 531 bytes
Line 
1import {Except} from './except';
2import {Simplify} from './simplify';
3
4type Merge_<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
5
6/**
7Merge two types into a new type. Keys of the second type overrides keys of the first type.
8
9@example
10```
11import {Merge} from 'type-fest';
12
13type Foo = {
14 a: number;
15 b: string;
16};
17
18type Bar = {
19 b: number;
20};
21
22const ab: Merge<Foo, Bar> = {a: 1, b: 2};
23```
24*/
25export type Merge<FirstType, SecondType> = Simplify<Merge_<FirstType, SecondType>>;
Note: See TracBrowser for help on using the repository browser.