// Project: Immutability helper // TypeScript Version: 2.2 export default update declare function update( data: ReadonlyArray, query: ArrayOperators, ): ReadonlyArray declare function update( data: ReadonlySet, query: SetOperators, ): ReadonlySet declare function update( data: ReadonlyMap, query: MapOperators, ): ReadonlyMap declare function update(data: T, query: Query): T type Tree = {[K in keyof T]?: Query} export type Query = | Tree | ObjectOperators | ArrayOperators | SetOperators type ObjectOperators = | {$set: any} | {$toggle: Array} | {$unset: Array} | {$merge: Partial} | {$apply: (old: T) => T} | ((old: T) => any) type ArrayOperators = | {$push: T} | {$unshift: T} | {$splice: Array<[number, number]>} | {[customCommand: string]: any} type MapOperators = {$add: Array<[K, V]>} | {$remove: K[]} type SetOperators = {$add: T[]} | {$remove: T[]} declare namespace update { function newContext(): typeof update function extend( command: Command, handler: (param: CommandArg, old: T) => T, ): void type Command = string type CommandArg = any }