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