fix(package): use generics to define return type

This commit is contained in:
Luke
2022-09-17 20:21:06 +02:00
parent 95dd3b1838
commit 5549fd4cff

View File

@@ -4,7 +4,7 @@ export const cache: Record<string, any> = 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<string, any> = new Proxy(
}
);
export const onCache = (key: string, cb: (value: any) => void) => {
export const onCache = <T = any>(key: string, cb: (value: T) => void) => {
AddEventHandler(`ox_lib:cache:${key}`, cb);
};