@types/seamless-immutable
Advanced tools
Comparing version 7.1.9 to 7.1.10
@@ -35,4 +35,4 @@ // Type definitions for Seamless-immutable 7.1 | ||
interface AsMutableOptions { | ||
deep: boolean; | ||
interface AsMutableOptions<TDeep extends boolean = boolean> { | ||
deep: TDeep; | ||
} | ||
@@ -67,3 +67,5 @@ | ||
asMutable(opts?: AsMutableOptions): T; | ||
asMutable(opts?: AsMutableOptions<false>): { [K in keyof T]: Immutable<T[K]> }; | ||
asMutable(opts: AsMutableOptions<true>): T; | ||
asMutable(opts: AsMutableOptions): T | { [K in keyof T]: Immutable<T[K]> }; | ||
@@ -96,7 +98,10 @@ merge(part: DeepPartial<T>, config?: MergeConfig): Immutable<T>; | ||
/** An ImmutableArray provides read-only access to the array elements, and provides functions (such as `map()`) that return immutable data structures. */ | ||
type ImmutableArray<T> = Readonly<ImmutableArray.Remaining<T> & ImmutableArray.Additions<T> & ImmutableArray.Overrides<T>>; | ||
type ImmutableArray<T> = Readonly<ImmutableArray.Remaining<T>> & ImmutableArray.Additions<T> & ImmutableArray.Overrides<T> & ImmutableArray.ReadOnlyIndexer<T>; | ||
namespace ImmutableArray { | ||
/** New methods added by seamless-immutable. */ | ||
interface Additions<T> { | ||
asMutable(opts?: AsMutableOptions): T[]; | ||
asMutable(opts?: AsMutableOptions<false>): Array<Immutable<T>>; | ||
asMutable(opts: AsMutableOptions<true>): T[]; | ||
asMutable(opts: AsMutableOptions): T[] | Array<Immutable<T>>; | ||
asObject<U extends object = {}, K extends keyof U = keyof U>(toKeyValue: (item: T) => [K, U[K]]): Immutable<U>; | ||
@@ -108,14 +113,20 @@ flatMap<TTarget>(mapFunction: (item: T) => TTarget): Immutable<TTarget extends any[] ? TTarget : TTarget[]>; | ||
interface Overrides<T> { | ||
map<TTarget>(mapFuction: (item: T) => TTarget): Immutable<TTarget[]>; | ||
filter(filterFunction: (item: T) => boolean): Immutable<T[]>; | ||
forEach(callbackfn: (value: Immutable<T>, index: number, array: Immutable<T[]>) => void, thisArg?: any): void; | ||
map<TTarget>(mapFuction: (item: Immutable<T>) => TTarget): Immutable<TTarget[]>; | ||
filter(filterFunction: (item: Immutable<T>) => boolean): Immutable<T[]>; | ||
slice(start?: number, end?: number): Immutable<T[]>; | ||
concat(...arr: Array<T|T[]|Immutable<T|T[]>>): Immutable<T[]>; | ||
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): Immutable<T>; | ||
reduce<TTarget>(callbackfn: (previousValue: TTarget, currentValue: T, currentIndex: number, array: T[]) => TTarget, initialValue?: TTarget): Immutable<TTarget>; | ||
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): Immutable<T>; | ||
reduceRight<TTarget>(callbackfn: (previousValue: TTarget, currentValue: T, currentIndex: number, array: T[]) => TTarget, initialValue?: TTarget): Immutable<TTarget>; | ||
concat(...arr: Array<T|T[]|Immutable<T>|Array<Immutable<T>>|Immutable<T[]>>): Immutable<T[]>; | ||
reduce(callbackfn: (previousValue: Immutable<T>, currentValue: Immutable<T>, currentIndex: number, array: Immutable<T[]>) => T): Immutable<T>; | ||
reduce<TTarget>(callbackfn: (previousValue: TTarget, currentValue: Immutable<T>, currentIndex: number, array: Immutable<T[]>) => TTarget, initialValue?: TTarget): Immutable<TTarget>; | ||
reduceRight(callbackfn: (previousValue: Immutable<T>, currentValue: Immutable<T>, currentIndex: number, array: Immutable<T[]>) => T): Immutable<T>; | ||
reduceRight<TTarget>(callbackfn: (previousValue: TTarget, currentValue: Immutable<T>, currentIndex: number, array: Immutable<T[]>) => TTarget, initialValue?: TTarget): Immutable<TTarget>; | ||
} | ||
/** Merging this into Overrides breaks stuff, so this is split out */ | ||
interface ReadOnlyIndexer<T> { | ||
readonly [key: number]: Immutable<T>; | ||
} | ||
/** These methods are banned by seamless-immutable. */ | ||
type MutatingArrayMethods = Extract<keyof any[], 'push' | 'pop' | 'sort' | 'splice' | 'shift' | 'unshift' | 'reverse'>; | ||
type MutatingArrayMethods = Extract<keyof any[], 'push' | 'pop' | 'sort' | 'splice' | 'shift' | 'unshift' | 'reverse' | number>; | ||
@@ -167,3 +178,3 @@ /** NOTE: These methods mutate data, but seamless-immutable does not ban them. We will ban them in our type definitions. */ | ||
function isImmutable(target: any): boolean; | ||
function isImmutable<T>(target: T | Immutable<T>): target is Immutable<T>; | ||
function ImmutableError(message: string): Error; | ||
@@ -170,0 +181,0 @@ |
{ | ||
"name": "@types/seamless-immutable", | ||
"version": "7.1.9", | ||
"version": "7.1.10", | ||
"description": "TypeScript definitions for Seamless-immutable", | ||
@@ -42,4 +42,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "2d65728a5659b561f62219e24e4c343421c401851f6e052197f5afb2ae3737d4", | ||
"typesPublisherContentHash": "ab0392bd1937af8013d0ea7c9a361b7e8b47576eb37a6edfcdbd4a7d879b6507", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Tue, 23 Apr 2019 18:57:10 GMT | ||
* Last updated: Tue, 07 May 2019 18:14:22 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14455
145