# TS8009: The '…' modifier can only be used in TypeScript files.

> A TypeScript-only modifier like `public`, `private`, `readonly` or `declare` appears in a JavaScript file. Remove it.

## What it means

Modifiers that only exist in TypeScript (`public`, `private`, `protected`, `readonly`,
`abstract`, `declare`, `override` and similar) can't appear in a `.js` file. The message names
the modifier.

ts-r's parser reports this code when it reads `.js` files with tsc's rules for TypeScript syntax in JavaScript. `ts-r-check` doesn't report it yet: today it parses `.js` files with the plain JavaScript grammar and reports a syntax error at the same place instead.

## Example

```js
class Account {
  private balance = 0;
}
```

## How to fix

- Remove the modifier. For real privacy at runtime, use a `#private` field: `#balance = 0;`.
- Rename the file to `.ts` if it's meant to be TypeScript.

Source: https://ts-r.dev/errors/TS8009/
