Options
All
  • Public
  • Public/Protected
  • All
Menu

Type aliases

Type aliases

Patch

Patch<O, O1, depth, ignore, fill>: object[depth]

Complete the fields of O with the ones of O1. This is a version of Merge that does NOT handle optional fields, it only completes fields of O with the ones of O1.

Type parameters

  • O: object

    to complete

  • O1: object

    to copy from

  • depth: Depth

    (?='flat') 'deep' to do it deeply

  • ignore: object

    (?=BuiltIn) types not to merge

  • fill: any

    (?=never) types of O to be replaced with ones of O1

returns

Object

example

import {O} from 'ts-toolbelt'

type O = {
 name?: string
 age? : number
 zip? : string
 pay  : {
     cvv?: number
 }
}

type O1 = {
 age : number
 zip?: number
 city: string
 pay : {
     cvv : number
     ccn?: string
 }
}

type test = O.Patch<O, O1, 'deep'>
// {
//     name?: string;
//     age?: number;
//     zip?: string | number;
//     pay: {
//         cvv?: number;
//         ccn?: string;
//     };
//     city: string;
// }

  • Inherited
  • Protected
  • Private
  • Static
  • Module
  • Object
  • Property
  • Function
  • Variable
  • Index
  • Type
  • Class
  • Interface
  • Enum
  • Constructor
  • Getter/Setter
Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.