// Type definitions for Seamless-immutable 7.1 // Project: https://github.com/rtfeldman/seamless-immutable // Definitions by: alex3165 // Stepan Burguchev // Geir Sagberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 export = SeamlessImmutable; declare namespace SeamlessImmutable { type DeepPartial = { [P in keyof T]?: DeepPartial; }; interface MergeConfig { deep?: boolean; merger?(a: any, b: any, config: any): any; } interface Options { prototype?: any; } interface AsMutableOptions { deep: boolean; } interface ImmutableObjectMixin { set(property: K, value: T[K]): ImmutableObject; set(property: string, value: TValue): ImmutableObject; setIn(propertyPath: [ K ], value: T[K]): ImmutableObject; setIn(propertyPath: [ K, L ], value: T[K][L]): ImmutableObject; setIn(propertyPath: [ K, L, M ], value: T[K][L][M]): ImmutableObject; setIn( propertyPath: [ K, L, M, N ], value: T[K][L][M][N]): ImmutableObject; setIn( propertyPath: [ K, L, M, N, O ], value: T[K][L][M][N][O]): ImmutableObject; setIn(propertyPath: string[], value: TValue): ImmutableObject; getIn(propertyPath: [ K ]): Immutable; getIn(propertyPath: [ K ], defaultValue: T[K]): Immutable; getIn(propertyPath: [ K, L ]): Immutable; getIn(propertyPath: [ K, L ], defaultValue: T[K][L]): Immutable; getIn(propertyPath: [ K, L, M ]): Immutable; getIn(propertyPath: [ K, L, M, N ]): Immutable; getIn(propertyPath: [ K, L, M, N ], defaultValue: T[K][L][M][N]): Immutable; getIn( propertyPath: [ K, L, M, N, O ]): Immutable; getIn( propertyPath: [ K, L, M, N, O ], defaultValue: T[K][L][M][N][O]): Immutable; getIn(propertyPath: string[]): Immutable; getIn(propertyPath: string[], defaultValue: TValue): Immutable; asMutable(opts?: AsMutableOptions): T; merge(part: DeepPartial, config?: MergeConfig): ImmutableObject; update(property: K, updaterFunction: (value: T[K], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; update(property: string, updaterFunction: (value: TValue, ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; updateIn( propertyPath: [ K ], updaterFunction: (value: T[K], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; updateIn( propertyPath: [ K, L ], updaterFunction: (value: T[K][L], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; updateIn( propertyPath: [ K, L, M ], updaterFunction: (value: T[K][L][M], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; updateIn( propertyPath: [ K, L, M, N ], updaterFunction: (value: T[K][L][M][N], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; updateIn( propertyPath: [ K, L, M, N, O ], updaterFunction: (value: T[K][L][M][N][O], ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; updateIn(propertyPath: string[], updaterFunction: (value: TValue, ...additionalParameters: any[]) => any, ...additionalArguments: any[]): ImmutableObject; without(property: K): ImmutableObject; without(...properties: K[]): ImmutableObject; without(filter: (value: T[K], key: K) => boolean): ImmutableObject; } interface ImmutableArrayMixin { asMutable(opts?: AsMutableOptions): T[]; asObject(toKeyValue: (item: T) => [string, any]): ImmutableObject; flatMap(mapFunction: (item: T) => TTarget[]): ImmutableArray; } type ImmutableObject = T & ImmutableObjectMixin; type ImmutableArray = T[] & ImmutableArrayMixin; type Immutable = ImmutableObject | ImmutableArray; function from(obj: T[], options?: Options): ImmutableArray; function from(obj: T, options?: Options): ImmutableObject; function isImmutable(target: any): boolean; function ImmutableError(message: string): Error; } declare function SeamlessImmutable(obj: T[], options?: SeamlessImmutable.Options): SeamlessImmutable.ImmutableArray; declare function SeamlessImmutable(obj: T, options?: SeamlessImmutable.Options): SeamlessImmutable.ImmutableObject;