- Error
- Reported by the type checker
TS1028
Accessibility modifier already seen.
A class member or parameter property has two accessibility modifiers (`public`, `private` or `protected`). Keep only one.
What it means
A member can have at most one of public, private and protected. Writing two, even the same one twice, is an error. It's reported on the second modifier, for class members and for constructor parameter properties.
Example
export class User {
public private name = "";
}
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(2,10): error TS1028: Accessibility modifier already seen.
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 one of the modifiers and keep the visibility you mean.
- Members are
publicby default, sopubliccan usually be dropped.