diff --git a/src/index.ts b/src/index.ts index c6ec911..7cc1236 100644 --- a/src/index.ts +++ b/src/index.ts @@ -148,12 +148,14 @@ export const factory = function ( return prop; } } - if (desc?.get) { - return target[property as keyof T]; - } + return async (...args: any[]): Promise => { await target.loadLibs(module); + if (desc?.get) { + return target[property as keyof T]; + } + return (target[property as keyof T] as Function)(...args); }; },