From 9decf94f7641bb849c4ac16fc82b93b3cc62d225 Mon Sep 17 00:00:00 2001 From: Juri Naidenov Date: Tue, 17 Dec 2024 11:39:50 +0100 Subject: [PATCH] preserve args type when wrapping --- packages/cacheable/src/index.ts | 2 +- packages/cacheable/src/memory.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cacheable/src/index.ts b/packages/cacheable/src/index.ts index 51a866eb..5c8e01e7 100644 --- a/packages/cacheable/src/index.ts +++ b/packages/cacheable/src/index.ts @@ -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(function_: (...arguments_: any[]) => T, options?: WrapFunctionOptions): (...arguments_: any[]) => T { + wrap(function_: (...arguments_: Args) => T, options?: WrapFunctionOptions): (...arguments_: Args) => T { const wrapOptions = { ttl: options?.ttl ?? this._ttl, keyPrefix: options?.keyPrefix, diff --git a/packages/cacheable/src/memory.ts b/packages/cacheable/src/memory.ts index b94e207d..070eec27 100644 --- a/packages/cacheable/src/memory.ts +++ b/packages/cacheable/src/memory.ts @@ -598,7 +598,7 @@ export class CacheableMemory extends Hookified { * @param {Object} [options] - The options to wrap * @returns {Function} - The wrapped function */ - public wrap(function_: (...arguments_: any[]) => T, options?: WrapFunctionOptions): (...arguments_: any[]) => T { + wrap(function_: (...arguments_: Args) => T, options?: WrapFunctionOptions): (...arguments_: Args) => T { const wrapOptions = { ttl: options?.ttl ?? this._ttl, keyPrefix: options?.keyPrefix,