vscode-refactorix icon indicating copy to clipboard operation
vscode-refactorix copied to clipboard

Arrow function refactoring corrupts code

Open keremispirli opened this issue 8 years ago • 0 comments

this.promise = new Promise<T>((resolve, reject) => {
     this.resolve = resolve;
     this.reject = reject;
     let a = 42;
});

Abracadabra! (triggers extension.refactorix.ArrowFunction.ToggleSingleStatementBlockExpression)

this.promise = new Promise<T>((resolve, reject) => this.resolve = resolve); BaDumTssss

Notes:

  • extension.refactorix.ArrowFunction.SingleStatementBlockToExpressionAll does the same thing to whole file
  • Add an if statement into that block and you are safe.

keremispirli avatar Jan 26 '17 15:01 keremispirli