Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on inheriting Koa #15

Open
mivinci opened this issue Nov 30, 2019 · 1 comment
Open

Question on inheriting Koa #15

mivinci opened this issue Nov 30, 2019 · 1 comment

Comments

@mivinci
Copy link

mivinci commented Nov 30, 2019

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.

@DelBlank
Copy link

same question, solved this problem ?

@jonathanong jonathanong transferred this issue from koajs/koa Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants