// Type definitions for deep-diff 1.0 // Project: https://github.com/flitbit/diff/ // Definitions by: ZauberNerd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 export interface DiffNew { kind: 'N'; path?: any[] | undefined; rhs: RHS; } export interface DiffDeleted { kind: 'D'; path?: any[] | undefined; lhs: LHS; } export interface DiffEdit { kind: 'E'; path?: any[] | undefined; lhs: LHS; rhs: RHS; } export interface DiffArray { kind: 'A'; path?: any[] | undefined; index: number; item: Diff; } export type Diff = DiffNew | DiffDeleted | DiffEdit | DiffArray; export type PreFilterFunction = (path: any[], key: any) => boolean; export interface PreFilterObject { prefilter?(path: any[], key: any): boolean; normalize?(currentPath: any, key: any, lhs: LHS, rhs: RHS): [ LHS, RHS ] | undefined; } export type PreFilter = PreFilterFunction | PreFilterObject; export interface Accumulator { push(diff: Diff): void; length: number; } export type Observer = (diff: Diff) => void; export type Filter = (target: LHS, source: RHS, change: Diff) => boolean; export function diff(lhs: LHS, rhs: RHS, prefilter?: PreFilter): Array> | undefined; export function diff(lhs: LHS, rhs: RHS, prefilter?: PreFilter, acc?: Accumulator): Accumulator; export function orderIndependentDiff(lhs: LHS, rhs: RHS, prefilter?: PreFilter): Array> | undefined; export function orderIndependentDiff(lhs: LHS, rhs: RHS, prefilter?: PreFilter, acc?: Accumulator): Accumulator; export function observableDiff(lhs: LHS, rhs: RHS, observer?: Observer, prefilter?: PreFilter, orderIndependent?: boolean): Array>; export function orderIndependentDeepDiff(lhs: LHS, rhs: RHS, changes: Array>, prefilter: PreFilter, path: any[], key: any, stack: any[]): void; export function orderIndepHash(object: any): number; export function applyDiff(target: LHS, source: RHS, filter?: Filter): void; export function applyChange(target: LHS, source: any, change: Diff): void; export function revertChange(target: LHS, source: any, change: Diff): void;