See a74f109#r36149273
When creating tagged template literals programmatically one can pass in cooked and raw text.
The raw text is then checked by rescanning it and checking it is the same as the cooked text.
There is a bug in this check. After an expression the next part will start with a closing brace }, which triggers the scanner to then search to the next ${ or to the end of the the backticked string. But the current code is looking for a ] rather than a }.
Search Terms:
rawText, tagged template literals, createTemplateMiddle, getCookedText
Code
const ts = require('typescript');
ts.createTemplateMiddle('a\nb', 'a\\nb');
Expected behavior:
Should not throw
Actual behavior:
Thrown:
Error: Debug Failure. Invalid raw text
at createTemplateLiteralLikeNode (/Users/pete/dev/angular/angular/node_modules/typescript/lib/typescript.js:64078:33)
at Object.createTemplateMiddle (/Users/pete/dev/angular/angular/node_modules/typescript/lib/typescript.js:64092:20)
See a74f109#r36149273
When creating tagged template literals programmatically one can pass in cooked and raw text.
The raw text is then checked by rescanning it and checking it is the same as the cooked text.
There is a bug in this check. After an expression the next part will start with a closing brace
}, which triggers the scanner to then search to the next${or to the end of the the backticked string. But the current code is looking for a]rather than a}.Search Terms:
rawText, tagged template literals, createTemplateMiddle, getCookedText
Code
Expected behavior:
Should not throw
Actual behavior: