keep proper type

This commit is contained in:
Nuckyz 2024-05-15 23:07:35 -03:00
parent 4feaa40de7
commit 5168f326a3
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -68,7 +68,7 @@ const handler: ProxyHandler<any> = {
* @returns Result of factory function
*/
export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild = false): ProxyLazy<T> {
const get = makeLazy(factory, attempts, { isIndirect: true }) as any;
const get = makeLazy(factory, attempts, { isIndirect: true });
let isSameTick = true;
if (!isChild) setTimeout(() => isSameTick = false, 0);
@ -76,6 +76,7 @@ export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild
const proxyDummy = Object.assign(function ProxyDummy() { }, {
[proxyLazyGet]() {
if (!proxyDummy[proxyLazyCache]) {
// @ts-ignore
if (!get.$$vencordLazyFailed()) {
proxyDummy[proxyLazyCache] = get();
}