# TypeScript configuration

> Source: https://docs.strapi.io/cms/configurations/typescript

TypeScript configuration explains the project’s tsconfig files, output directories, and an optional `config/typescript.js|ts` that auto-generates types on server restart. This documentation explains which folders store compiled code and how to toggle this experimental feature.

[TypeScript](/cms/typescript)-enabled Strapi projects have a specific project structure and handle TypeScript project configuration through [`tsconfig.json` files](#project-structure-and-typescript-specific-configuration-files).

Strapi also has dedicated TypeScript features that are configured [in the `config/typescript.js|ts` file](#strapi-specific-configuration-for-typescript).

## Project structure and TypeScript-specific configuration files

TypeScript-enabled Strapi applications have a specific [project structure](/cms/project-structure) with the following dedicated folders and configuration files:

| TypeScript-specific directories and files | Location         | Purpose                                                                                                                                          |
| ----------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `./dist` directory                        | application root | Adds the location for compiling the project JavaScript source code.                                                                              |
| `build` directory                         | `./dist`         | Contains the compiled administration panel JavaScript source code. The directory is created on the first `yarn build` or `npm run build` command |
| `tsconfig.json` file                      | application root | Manages TypeScript compilation for the server.                                                                                                   |
| `tsconfig.json` file                      | `./src/admin/`   | Manages TypeScript compilation for the admin panel.                                                                                              |

## Strapi-specific configuration for TypeScript

:::caution 🚧 This feature is considered experimental.
These settings are considered experimental and might have issues or break some features.
:::

Types generated by Strapi are based on the user project structure. Once the type definitions are emitted into their dedicated files, Strapi reads the type definitions to adapt the autocompletion results accordingly.

To avoid having to [manually generate types](/cms/typescript/development#generate-typings-for-content-types-schemas) every time the server restarts, an optional `config/typescript.js|ts` configuration file can be added, which currently accepts only one parameter:

| Parameter      | Description                                                    | Type      | Default |
| -------------- | -------------------------------------------------------------- | --------- | ------- |
| `autogenerate` | Enable or disable automatic types generation on server restart | `Boolean` | `false` |

**Example:**

```js title="./config/typescript.js"
module.exports = ({ env }) => ({
  autogenerate: true,
});
```

```ts title="./config/typescript.ts"

  autogenerate: true,
});
```
