From 833008d74ed69b881a5a11c7a3cfb89239d5b11b Mon Sep 17 00:00:00 2001 From: Ross Harrison Date: Fri, 22 Mar 2019 12:43:37 -0400 Subject: [PATCH 1/3] Allow SeamlessImmutable/ImmutableArray.concat to accept an array argument --- types/seamless-immutable/index.d.ts | 6 +++--- types/seamless-immutable/seamless-immutable-tests.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/types/seamless-immutable/index.d.ts b/types/seamless-immutable/index.d.ts index 1206034846..493b721b11 100644 --- a/types/seamless-immutable/index.d.ts +++ b/types/seamless-immutable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Seamless-immutable 7.1 +// Type definitions for Seamless-immutable 7.2 // Project: https://github.com/rtfeldman/seamless-immutable // Definitions by: alex3165 // Stepan Burguchev @@ -57,7 +57,7 @@ declare namespace SeamlessImmutable { 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; + 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; @@ -105,7 +105,7 @@ declare namespace SeamlessImmutable { map(mapFuction: (item: T) => TTarget): Immutable; filter(filterFunction: (item: T) => boolean): Immutable; slice(start?: number, end?: number): Immutable; - concat(...arr: T[]): Immutable; + concat(...arr: Array): Immutable; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): Immutable; reduce(callbackfn: (previousValue: TTarget, currentValue: T, currentIndex: number, array: T[]) => TTarget, initialValue?: TTarget): Immutable; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): Immutable; diff --git a/types/seamless-immutable/seamless-immutable-tests.ts b/types/seamless-immutable/seamless-immutable-tests.ts index 1e54f9eff6..b44dc58543 100644 --- a/types/seamless-immutable/seamless-immutable-tests.ts +++ b/types/seamless-immutable/seamless-immutable-tests.ts @@ -120,7 +120,14 @@ interface ExtendedUser extends User { // concat. Call the mutable array's 'concat' with the same args to ensure compatability. Make sure the output array is immutable. array.asMutable().concat({ firstName: 'Happy', lastName: 'Cat' }); - const concat: Immutable.Immutable = array.concat({ firstName: 'Happy', lastName: 'Cat' }); + const concat: Immutable.Immutable = array + .concat({ firstName: 'Happy', lastName: 'Cat' }, { firstName: 'Silly', lastName: 'Cat' }) + .concat([{firstName: 'saucy', lastName: 'Cat'}], {firstName: 'Fussy', lastName: 'Cat'}) + .concat([ + {firstName: 'Fancy', lastName: 'Cat'}, + {firstName: 'Sassy', lastName: 'Cat'}], + [{firstName: 'Bossy', lastName: 'Cat'} + ]); concat.asMutable(); // reduce. Call the mutable array's 'reduce' with the same function to ensure compatability. Make sure the output array is immutable. From 73a5dca4415c7b44238958da7caa1ffce8d86176 Mon Sep 17 00:00:00 2001 From: Ross Harrison Date: Thu, 11 Apr 2019 11:42:25 -0500 Subject: [PATCH 2/3] Update index.d.ts --- types/seamless-immutable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/seamless-immutable/index.d.ts b/types/seamless-immutable/index.d.ts index 493b721b11..739eafb463 100644 --- a/types/seamless-immutable/index.d.ts +++ b/types/seamless-immutable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Seamless-immutable 7.2 +// Type definitions for Seamless-immutable 7.1 // Project: https://github.com/rtfeldman/seamless-immutable // Definitions by: alex3165 // Stepan Burguchev From 6d36cb6df53d3dde2ac6698b3b062637a7df3316 Mon Sep 17 00:00:00 2001 From: Ross Harrison Date: Thu, 11 Apr 2019 11:43:25 -0500 Subject: [PATCH 3/3] fix lint error --- types/seamless-immutable/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/seamless-immutable/index.d.ts b/types/seamless-immutable/index.d.ts index 739eafb463..ebf546d409 100644 --- a/types/seamless-immutable/index.d.ts +++ b/types/seamless-immutable/index.d.ts @@ -57,7 +57,7 @@ declare namespace SeamlessImmutable { 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 + 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;