@mnrendra/ts-types-merge
v2.0.0
Published
TypeScript utility type to merge base object type with a new one.
Downloads
1
Readme
@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: ''
}