Skip to content

Commit

Permalink
Abstract class type workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert committed Dec 11, 2023
1 parent 3a54001 commit bcbea48
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions deno-runtime/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import * as Messenger from './lib/messenger.ts';
import { AppObjectRegistry } from './AppObjectRegistry.ts';

import type { IParseAppPackageResult } from '@rocket.chat/apps-engine/server/compiler/IParseAppPackageResult.ts';
import type { App as AbstractApp } from '@rocket.chat/apps-engine/definition/App.ts';

type App = typeof AbstractApp;

const require = createRequire(import.meta.url);

Expand Down Expand Up @@ -61,8 +58,12 @@ async function handlInitializeApp(appPackage: IParseAppPackageResult): Promise<v

const require = buildRequire();
const exports = await wrapAppCode(source)(require);

// This is the same naive logic we've been using in the App Compiler
const appClass = Object.values(exports)[0] as App;
// Applying the correct type here is quite difficult because of the dynamic nature of the code
// deno-lint-ignore no-explicit-any
const appClass = Object.values(exports)[0] as any;

// What do I do here? D:
const app = new appClass(appPackage.info, console, AppAccessorsInstance.getDefaultAppAccessors());

Expand Down

0 comments on commit bcbea48

Please sign in to comment.