Skip to content

Commit db44c6c

Browse files
committed
refactor: fix random return type
1 parent b9db3b5 commit db44c6c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/bentocache/src/cache/facades/remote_cache.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ export class RemoteCache {
3838
* Try to execute a cache operation and fallback to a default value
3939
* if the operation fails
4040
*/
41-
async #tryCacheOperation<T>(
41+
async #tryCacheOperation<T, K>(
4242
operation: string,
4343
options: CacheEntryOptions,
44-
fallbackValue: unknown,
44+
fallbackValue: K,
4545
fn: () => T,
46-
): Promise<T> {
46+
): Promise<T | K> {
4747
if (this.#circuitBreaker?.isOpen()) {
4848
this.#logger.error({ opId: options.id }, `circuit breaker is open. ignoring operation`)
49-
return fallbackValue as any
49+
return fallbackValue
5050
}
5151

5252
try {
@@ -64,7 +64,7 @@ export class RemoteCache {
6464
(is.undefined(options.suppressL2Errors) && this.#hasL1Backup) ||
6565
options.suppressL2Errors
6666
) {
67-
return fallbackValue as any
67+
return fallbackValue
6868
}
6969

7070
throw error

0 commit comments

Comments
 (0)