Skip to content

Commit 069b26c

Browse files
authored
add return type generic to memo func (#381)
1 parent 2be4acf commit 069b26c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "radash",
3-
"version": "12.0.0",
3+
"version": "12.1.0",
44
"description": "Functional utility library - modern, simple, typed, powerful",
55
"main": "dist/cjs/index.cjs",
66
"module": "dist/esm/index.mjs",

src/curry.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,16 @@ const memoize = <TArgs extends any[], TResult>(
466466
* is given previously computed values will be checked
467467
* for expiration before being returned.
468468
*/
469-
export const memo = <TArgs extends any[]>(
470-
func: (...args: TArgs) => any,
469+
export const memo = <TArgs extends any[], TResult>(
470+
func: (...args: TArgs) => TResult,
471471
options: {
472472
key?: (...args: TArgs) => string
473473
ttl?: number
474474
} = {}
475475
) => {
476476
return memoize({}, func, options.key ?? null, options.ttl ?? null) as (
477477
...args: TArgs
478-
) => any
478+
) => TResult
479479
}
480480

481481
export type DebounceFunction<TArgs extends any[]> = {

0 commit comments

Comments
 (0)