4ea3287ff036e0b37d3ccf2b83ec36454641d002f3ee0c9194ce607c46677687d0d30ab494947cef4e6422384e53d8d1f369d90d8a1733ca093c8870c1ae80 531 B

12345678910111213141516171819202122232425
  1. import {Except} from './except';
  2. import {Simplify} from './simplify';
  3. type Merge_<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
  4. /**
  5. Merge two types into a new type. Keys of the second type overrides keys of the first type.
  6. @example
  7. ```
  8. import {Merge} from 'type-fest';
  9. type Foo = {
  10. a: number;
  11. b: string;
  12. };
  13. type Bar = {
  14. b: number;
  15. };
  16. const ab: Merge<Foo, Bar> = {a: 1, b: 2};
  17. ```
  18. */
  19. export type Merge<FirstType, SecondType> = Simplify<Merge_<FirstType, SecondType>>;