diff --git a/src/InSite.ts b/src/InSite.ts index 1847e4f..eabf2c1 100644 --- a/src/InSite.ts +++ b/src/InSite.ts @@ -146,10 +146,14 @@ export class InSite> extends E } - static init>(options: IO) { - type IAS = IO extends Options ? EIAS : never; - - return (new InSite(options)).whenReady() as Promise, IO>>; + static init, IAS extends AbilitiesSchema = IO extends Options ? A : never>(options: IO, asPromise: true): Promise, IO>>; + static init, IAS extends AbilitiesSchema = IO extends Options ? A : never>(options: IO, asPromise?: false): InSiteWithActualProps, IO>; + static init, IAS extends AbilitiesSchema = IO extends Options ? A : never>(options: IO, asPromise = false) { + const inSite = new InSite(options); + + return asPromise ? + inSite.whenReady() as Promise, IO>> : + inSite as InSiteWithActualProps, IO>; } }