I wanted to inherit Koa in TypeScript to add a few properties and methods to Context because adding by using prototype does not support the auto-complete for the editor. But an error occurred when calling super.
Here's my code:
import * as Koa from "koa";
class App extends Koa {
constructor() {
super();
this.use(compose([error]));
}
}
const app = new App();
Here's the error:
TypeError: Class constructor Application cannot be invoked without 'new'
I tried just import Application from Koa, but the same error occurred.
I wanted to inherit Koa in TypeScript to add a few properties and methods to
Context
because adding by usingprototype
does not support the auto-complete for the editor. But an error occurred when callingsuper
.Here's my code:
Here's the error:
I tried just import
Application
from Koa, but the same error occurred.