[@types/memoizee] More accurate types for normalizer option (#38060)

* Improve typings for `normalizer` memoizee option

* Fix build

* Fix test
This commit is contained in:
Igor Savin
2019-09-06 17:46:17 -07:00
committed by Andrew Casey
parent cd20b24ae5
commit 355ee52e9b
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ declare namespace memoizee {
dispose?(value: any): void;
async?: boolean;
primitive?: boolean;
normalizer?(value: any): void;
normalizer?(args: any[]): string;
resolvers?: Array<(arg: any) => any>;
}
+1 -1
View File
@@ -26,7 +26,7 @@ memoized.clear('bar', 7); // Dispose called with bar7 value
memoized.delete('foo', 0);
const mFn = memoize((hash: any) => {
// body of memoized function
}, { normalizer: (args: any) => {
}, { normalizer: (args: any[]) => {
// args is arguments object as accessible in memoized function
return JSON.stringify(args[0]);
} });