# TS8010: Type annotations can only be used in TypeScript files.

> A type annotation appears in a JavaScript file. Rename the file to .ts, or move the type into a JSDoc comment.

## What it means

JavaScript files can't contain TypeScript syntax. A `: Type` annotation on a variable,
parameter or return type in a `.js` file is reported here, at the type.

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 (TS1005) at the same place.

## Example

```js
let total: number = 1;
```

## How to fix

- Rename the file to `.ts` (or `.mts`/`.cts`) if it's meant to be TypeScript.
- Keep it JavaScript and write the type as JSDoc: `/** @type {number} */ let total = 1;`.

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