- Error
- Reported by the lexer and parser
TS1146
Declaration expected.
The parser expected a declaration here, for example after `export` or a decorator, but found something else.
What it means
Some keywords must be followed by a declaration: export (unless it's export { ... } or export default), declare, and decorators. This is reported when the next token can't start one.
Example
export namespace N { export 1 }
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(1,28): error TS1146: Declaration 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
- Complete the declaration:
export const one = 1. - Remove the stray
export,declareor decorator.