- Error
- Reported by the lexer and parser
TS1160
Unterminated template literal.
A template literal (backtick string) has no closing backtick before the end of the file. Add the missing backtick.
What it means
Template literals can span lines, so a missing closing backtick makes the rest of the file part of the string. The error is reported where the file ends.
Example
const msg = `hello ${name}
export {};
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(3,1): error TS1160: Unterminated template literal.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Add the closing backtick where the string should end.
- Look for a backtick inside the text that should be escaped as
\`.