@mnrendra/ts-types-merge
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@mnrendra/ts-types-merge

TypeScript utility type to merge base object type with a new one.

Install

npm i -D @mnrendra/ts-types-merge

Usage

import type { Merge } from '@mnrendra/ts-types-merge'

interface Base {
  name: string
  age: number
  address: {
    city: string
    country: string
  }
}

type Person = Merge<Base, {
  age: string
  address: Merge<Base['address'], {
    city: number
  }>
  email: string
}>

const person: Person = {
  name: '',
  age: '',
  address: {
    city: 0,
    country: ''
  },
  email: ''
}

Author

@mnrendra

Readme

Keywords

none

Package Sidebar

Install

npm i @mnrendra/ts-types-merge

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

2.5 kB

Total Files

4

Last publish

Collaborators

  • mnrendra