source: node_modules/type-fest/source/merge.d.ts

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 415 bytes
Line 
1import {Except} from './except';
2
3/**
4Merge two types into a new type. Keys of the second type overrides keys of the first type.
5
6@example
7```
8import {Merge} from 'type-fest';
9
10type Foo = {
11 a: number;
12 b: string;
13};
14
15type Bar = {
16 b: number;
17};
18
19const ab: Merge<Foo, Bar> = {a: 1, b: 2};
20```
21*/
22export type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
Note: See TracBrowser for help on using the repository browser.