Skip to content

Commit 399f5bc

Browse files
Mark the ts auto type generation as experimental (#1767)
* Mark the ts auto type generation as experimental * Update docusaurus/docs/dev-docs/configurations/typescript.md Co-authored-by: Ben Irvin <[email protected]> --------- Co-authored-by: Ben Irvin <[email protected]>
1 parent ab26c98 commit 399f5bc

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

docusaurus/docs/dev-docs/configurations/typescript.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
---
22
title: TypeScript configuration
33
displayed_sidebar: devDocsSidebar
4-
description: How to configure Strapi for TypeScript development.
5-
4+
description: How to configure Strapi for TypeScript development.
65
---
76

87
# TypeScript configuration
98

109
[TypeScript](/dev-docs/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).
1110

1211
Strapi also has dedicated TypeScript features that are configured [in the `config/typescript.js|ts` file](#strapi-specific-configuration-for-typescript).
13-
12+
1413
## Project structure and TypeScript-specific configuration files
1514

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

18-
| TypeScript-specific directories and files | Location | Purpose |
19-
|-------------------------------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
20-
| `./dist` directory | application root | Adds the location for compiling the project JavaScript source code. |
21-
| `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 |
22-
| `tsconfig.json` file | application root | Manages TypeScript compilation for the server. |
23-
| `tsconfig.json` file | `./src/admin/` | Manages TypeScript compilation for the admin panel. |
17+
| TypeScript-specific directories and files | Location | Purpose |
18+
| ----------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
19+
| `./dist` directory | application root | Adds the location for compiling the project JavaScript source code. |
20+
| `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 |
21+
| `tsconfig.json` file | application root | Manages TypeScript compilation for the server. |
22+
| `tsconfig.json` file | `./src/admin/` | Manages TypeScript compilation for the admin panel. |
2423

2524
## Strapi-specific configuration for TypeScript
2625

26+
:::caution 🚧 This feature is considered experimental.
27+
These settings are considered experimental and might have issues or break some features.
28+
:::
29+
2730
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.
2831

2932
To avoid having to [manually generate types](/dev-docs/typescript#generate-typings-for-project-schemas) every time the server restarts, an optional `config/typescript.js|ts` configuration file can be added, which currently accepts only one parameter:
@@ -39,7 +42,6 @@ To avoid having to [manually generate types](/dev-docs/typescript#generate-typin
3942
<TabItem value="javascript" label="JavaScript">
4043

4144
```js title="./config/typescript.js"
42-
4345
module.exports = ({ env }) => ({
4446
autogenerate: true,
4547
});
@@ -50,7 +52,6 @@ module.exports = ({ env }) => ({
5052
<TabItem value="typescript" label="TypeScript">
5153

5254
```ts title="./config/typescript.ts"
53-
5455
export default ({ env }) => ({
5556
autogenerate: true,
5657
});

0 commit comments

Comments
 (0)