# TS8008: Type aliases can only be used in TypeScript files.

> A `type` alias appears in a JavaScript file. Use a JSDoc `@typedef` or move it to a .ts file.

## What it means

`type Name = ...` declarations are TypeScript syntax and can't appear in a `.js` file.

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
type Id = string;
```

## How to fix

- Write it as JSDoc: `/** @typedef {string} Id */`.
- Move it to a `.ts` or `.d.ts` file.

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