Skip to content

Commit

Permalink
preserve args type when wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ebceu4 authored Dec 17, 2024
1 parent 34f13d7 commit 9decf94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/cacheable/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ export class Cacheable extends Hookified {
* @param {WrapOptions} [options] The options for the wrap function
* @returns {Function} The wrapped function
*/
public wrap<T>(function_: (...arguments_: any[]) => T, options?: WrapFunctionOptions): (...arguments_: any[]) => T {
wrap<T, Args extends any[]>(function_: (...arguments_: Args) => T, options?: WrapFunctionOptions): (...arguments_: Args) => T {

Check failure on line 579 in packages/cacheable/src/index.ts

View workflow job for this annotation

GitHub Actions / test (20)

The variable `Args` should be named `Arguments`. A more descriptive name will do too.

Check failure on line 579 in packages/cacheable/src/index.ts

View workflow job for this annotation

GitHub Actions / test (20)

The variable `Args` should be named `Arguments`. A more descriptive name will do too.

Check failure on line 579 in packages/cacheable/src/index.ts

View workflow job for this annotation

GitHub Actions / test (22)

The variable `Args` should be named `Arguments`. A more descriptive name will do too.
const wrapOptions = {
ttl: options?.ttl ?? this._ttl,
keyPrefix: options?.keyPrefix,
Expand Down
2 changes: 1 addition & 1 deletion packages/cacheable/src/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ export class CacheableMemory extends Hookified {
* @param {Object} [options] - The options to wrap
* @returns {Function} - The wrapped function
*/
public wrap<T>(function_: (...arguments_: any[]) => T, options?: WrapFunctionOptions): (...arguments_: any[]) => T {
wrap<T, Args extends any[]>(function_: (...arguments_: Args) => T, options?: WrapFunctionOptions): (...arguments_: Args) => T {

Check failure on line 601 in packages/cacheable/src/memory.ts

View workflow job for this annotation

GitHub Actions / test (20)

The variable `Args` should be named `Arguments`. A more descriptive name will do too.

Check failure on line 601 in packages/cacheable/src/memory.ts

View workflow job for this annotation

GitHub Actions / test (20)

The variable `Args` should be named `Arguments`. A more descriptive name will do too.

Check failure on line 601 in packages/cacheable/src/memory.ts

View workflow job for this annotation

GitHub Actions / test (22)

The variable `Args` should be named `Arguments`. A more descriptive name will do too.
const wrapOptions = {
ttl: options?.ttl ?? this._ttl,
keyPrefix: options?.keyPrefix,
Expand Down

0 comments on commit 9decf94

Please sign in to comment.