From 5549fd4cff6c5f43eea41555559ee621dccec0cf Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 17 Sep 2022 20:21:06 +0200 Subject: [PATCH] fix(package): use generics to define return type --- package/shared/resource/cache/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/shared/resource/cache/index.ts b/package/shared/resource/cache/index.ts index 59998df..acf0a6f 100644 --- a/package/shared/resource/cache/index.ts +++ b/package/shared/resource/cache/index.ts @@ -4,7 +4,7 @@ export const cache: Record = new Proxy( }, { get(target, key: string) { - let result = key ? target[key] : target; + const result = key ? target[key] : target; if (result) return result; AddEventHandler(`ox_lib:cache:${key}`, (value: any) => { @@ -17,6 +17,6 @@ export const cache: Record = new Proxy( } ); -export const onCache = (key: string, cb: (value: any) => void) => { +export const onCache = (key: string, cb: (value: T) => void) => { AddEventHandler(`ox_lib:cache:${key}`, cb); };