cancerberoSgx / typescript-plugins-of-mine

Research, documentation and finally useful TypeScript Language Service plugins for coe refactoring working on several IDEs / Editors like vscode, sublime and Atom that are very common in other typed languages and IDEs like Java / Eclipse
MIT License
90 stars 4 forks source link

Do not convert non-addition ancestor #10

Closed Fabrice-TIERCELIN closed 4 years ago

Fabrice-TIERCELIN commented 4 years ago

Given: let text1 = 'ba'; let text2 = 'ar'; let isTheSame = text1 + 'r' === 'b' + text2;

When: Refactoring enabling "String concatenation to template expression"...

Actual: let text1 = 'ba'; let text2 = 'ar'; let isTheSame = ${text1}r${b${text2}};

Expected: let text1 = 'ba'; let text2 = 'ar'; let isTheSame = ${text1}r === b${text2};

Operand types and operator should be checked.