保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {Except} from './except';
import {Simplify} from './simplify';
 
type Merge_<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
 
/**
Merge two types into a new type. Keys of the second type overrides keys of the first type.
 
@example
```
import {Merge} from 'type-fest';
 
type Foo = {
    a: number;
    b: string;
};
 
type Bar = {
    b: number;
};
 
const ab: Merge<Foo, Bar> = {a: 1, b: 2};
```
*/
export type Merge<FirstType, SecondType> = Simplify<Merge_<FirstType, SecondType>>;