- Error
- Reported by the lexer and parser
TS1141
String literal expected.
A string literal is required here, for example as the module name in `import ... from`. Quote the name.
What it means
Some places only accept a string literal: the module specifier of import, export ... from and import(...) types, and the name in declare module "name". A bare identifier or number there is reported.
Example
import x from 123;
export {};
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(1,15): error TS1141: String literal expected.
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
- Write the module name as a string:
import x from "./x";.