diff --git a/packages/realm-web/src/index.ts b/packages/realm-web/src/index.ts index af9a5f2989..c847cfb232 100644 --- a/packages/realm-web/src/index.ts +++ b/packages/realm-web/src/index.ts @@ -21,7 +21,7 @@ import { App } from "./App"; const appCache: { [id: string]: Realm.App } = {}; /** - * Get or create a Realm App from an id. + * Get or create a singleton Realm App from an id. * * @param id The Realm App id visible from the MongoDB Realm UI or a configuration * @returns The Realm App instance. Calling this function multiple times with the same id will return the same instance. @@ -30,9 +30,7 @@ export function app(id: string) { if (id in appCache) { return appCache[id]; } else { - // Ensures the App has the correct constructor type signature - const AppConstructor: Realm.AppConstructor = App; - const instance = new AppConstructor(id); + const instance = new App(id); appCache[id] = instance; return instance; } diff --git a/types/app.d.ts b/types/app.d.ts index 59931757b3..a577c33af6 100644 --- a/types/app.d.ts +++ b/types/app.d.ts @@ -106,19 +106,16 @@ declare namespace Realm { // TODO: Add providerCapabilities? } - /** - * The constructor of MongoDB Realm App. - */ - type AppConstructor = new < - FunctionsFactoryType extends object = DefaultFunctionsFactory - >( - idOrConfiguration: string | AppConfiguration, - ) => App; - /** * A MongoDB Realm App. */ class App { + /** + * Construct a MongoDB Realm App. + * + * @param idOrConfiguration The id string or configuration for the app. + */ + constructor(idOrConfiguration: string | AppConfiguration); /** *