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

fix(instrumenter): don't mutate constructor blocks with initialized class properties #2484

Conversation

nicojs
Copy link
Member

@nicojs nicojs commented Sep 17, 2020

Don't mutate constructor block statements when the class contains initialized class properties. For example:

class Foo extends Baz {
  bar = 'bar';
  constructor() {  // Don't mutate this block!
     super();
  }
}

If you mutate the constructor block above, and TypeScript transpiles the code, it will call this.bar before the super() is initiated. Resulting in a runtime error.

Fixes #2474

…lass properties

Don't mutate constructor block statements when the class contains initialized class properties.

Fixes #2474
@nicojs nicojs merged commit ca464a3 into epic/mutation-switching Sep 17, 2020
@nicojs nicojs deleted the fix/string-mutator-constructor-class-properties branch September 17, 2020 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant