File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 11type 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 )
You can’t perform that action at this time.
0 commit comments