born2net
born2net

Reputation: 24953

TypeScript: Error:(34, 50) TS17009: 'super' must be called before accessing 'this' (possible to disable error)

The following TypeScript:

constructor(options?:any) {
    this.m_options = options;
    this.m_blockType = 6022;
    _.extend(this.m_options, {blockType: this.m_blockType});
    super();
}

Produces the error:

Error:(34, 50) TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.

I want to call super after setting options. Is there a way to disable the TypeScript error?

Upvotes: 1

Views: 1598

Answers (1)

basarat
basarat

Reputation: 275819

Is there a way to disable the TypeScript error?

Nope. I requested something similar once : https://github.com/Microsoft/TypeScript/issues/4094 Please feel free to create a new issue with a clearer purpose of disabling errors for particular sections 🌹

Upvotes: 2

Related Questions