Skip to content

Commit f52f213

Browse files
committed
Fix return type of getColors
1 parent 910aa50 commit f52f213

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/tools/memoize.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
type SimpleType = number | string | boolean | null | undefined;
2-
type FuncWithSimpleParams<T extends SimpleType[]> = (...args: T) => any;
2+
type FuncWithSimpleParams<T extends SimpleType[], R> = (...args: T) => R;
33

4-
export function memoize<T extends SimpleType[]>(
5-
fn: FuncWithSimpleParams<T>,
4+
export function memoize<T extends SimpleType[], R>(
5+
fn: FuncWithSimpleParams<T, R>,
66
options?: {
77
argsLength?: number;
88
max?: number;
99
}
10-
): FuncWithSimpleParams<T> {
11-
const cache = new Map<string, ReturnType<FuncWithSimpleParams<T>>>();
10+
): FuncWithSimpleParams<T, R> {
11+
const cache = new Map<string, ReturnType<FuncWithSimpleParams<T, R>>>();
1212

1313
const { argsLength = fn.length, max = Infinity } = options ?? {};
1414

15-
return ((...args: Parameters<FuncWithSimpleParams<T>>) => {
15+
return ((...args: Parameters<FuncWithSimpleParams<T, R>>) => {
1616
const key = JSON.stringify(
1717
args
1818
.slice(0, argsLength)

0 commit comments

Comments
 (0)