Options
All
  • Public
  • Public/Protected
  • All
Menu

Type aliases

Type aliases

Update

Update<O, K, A>: { [P in keyof O]: P extends K ? Replace<A, x, O[P]> : O[P]} & object

Update in O the fields of key K with A. Use the x placeholder to get the current field type.

Type parameters

  • O: object

    to update

  • K: Key

    to chose fields

  • A: any

    to update with

returns

Object

example

import {A, O} from 'ts-toolbelt'

type User = {
 info: {
     name: string
     age: number
     payment: {}
 }
 id: number
}

type test0 = Update<User, 'id' | 'info', A.x | null>
// {
//     info: {
//         name: string;
//         age: number;
//         payment: {};
//     } | null;
//     id: number | null;
// }

  • 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.