From 8922f46b5adf49bd44fc7bf5db61d0df3bc593f0 Mon Sep 17 00:00:00 2001 From: Artur Eshenbrener Date: Tue, 4 Oct 2016 21:44:55 +0400 Subject: [PATCH] [lodash]: memoize.Cache expects construcor (#11707) https://lodash.com/docs/4.15.0#memoize --- lodash/lodash-tests.ts | 18 ++++++++++++------ lodash/lodash.d.ts | 5 ++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f00a5537ab..f0f958b0c8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5872,12 +5872,18 @@ namespace TestMemoize { result = _(memoizeFn).chain().memoize(memoizeResolverFn); } - _.memoize.Cache = { - delete: key => false, - get: key => undefined, - has: key => false, - set(key, value) { return this; } - }; + interface MemoizeCache { + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value: V): this; + } + interface MemoizeCacheConstructor { + new (): MemoizeCache; + } + let MemoizeCache: MemoizeCacheConstructor + + _.memoize.Cache = MemoizeCache; } // _.overArgs diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 68443af1fd..3305528a5e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -355,6 +355,9 @@ declare module _ { */ set(key: string, value: any): _.Dictionary; } + interface MapCacheConstructor { + new (): MapCache; + } interface LoDashWrapperBase { } @@ -10411,7 +10414,7 @@ declare module _ { */ memoize: { (func: T, resolver?: Function): T & MemoizedFunction; - Cache: MapCache; + Cache: MapCacheConstructor; } }