From c304d07299ade3a5bf7ff49f71b995fd29166b28 Mon Sep 17 00:00:00 2001 From: Paul Huynh Date: Wed, 16 Jan 2019 00:01:09 +1100 Subject: [PATCH] Update types/seamless-immutable/index.d.ts according to suggestions --- types/seamless-immutable/index.d.ts | 2 +- types/seamless-immutable/seamless-immutable-tests.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/seamless-immutable/index.d.ts b/types/seamless-immutable/index.d.ts index f5d3a2c3a3..1990dff0ab 100644 --- a/types/seamless-immutable/index.d.ts +++ b/types/seamless-immutable/index.d.ts @@ -96,7 +96,7 @@ declare namespace SeamlessImmutable { /** New methods added by seamless-immutable. */ interface Additions { asMutable(opts?: AsMutableOptions): T[]; - asObject(toKeyValue: (item: T) => [string, any]): Immutable; + asObject(toKeyValue: (item: T) => [K, U[K]]): Immutable; flatMap(mapFunction: (item: T) => TTarget): Immutable; } diff --git a/types/seamless-immutable/seamless-immutable-tests.ts b/types/seamless-immutable/seamless-immutable-tests.ts index 5b1a33d0bb..1e54f9eff6 100644 --- a/types/seamless-immutable/seamless-immutable-tests.ts +++ b/types/seamless-immutable/seamless-immutable-tests.ts @@ -155,7 +155,10 @@ interface ExtendedUser extends User { ); // asObject - const arrayToObject1: Immutable.Immutable = array.asObject((value) => [value.toString(), value]); + interface ArrayToObjectResult { + theFirstName: string; + } + const arrayToObject1: Immutable.Immutable = array.asObject((value) => ['theFirstName', value.firstName]); } //