- Error
- Reported by the type checker
TS1090
'{0}' modifier cannot appear on a parameter.
A modifier that is not allowed on parameters, such as `export`, is used on a function or constructor parameter. Remove it.
What it means
Parameters accept only a few modifiers, and only in a constructor: public, private, protected, readonly and override turn the parameter into a class property. Other modifiers such as export are reported here.
Example
export class A {
constructor(export name: string) {}
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,15): error TS1090: 'export' modifier cannot appear on a parameter.
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
- Delete the modifier.
- To declare a property from a constructor parameter, use
public,private,protectedorreadonly.