You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add TS config to inline TOC in config. intro
* Rewrite TypeScript configuration docs to include config/typescript.ts
* Mention auto-types generation in TypeScript development docs
* Remove TypeScript mentions from the table
* Reword description for `autogenerate`
* Rework the whole and TOC to clarify autocomplete/autogenerate
* Removed beta badge
* Remove autcomplete from title
* Simplify TS config. page introduction
* Simplify config/typescript.ts intro.
* Fix autogenerate behavior description
* Remove unnecessary link
* Rename "TypeScript configuration" for TOC
* Fix header link
* Shorten heading link
* Revert "Removed beta badge"
This reverts commit b51cc99.
* Don't mention autogenerate is beta in TypeScript docs
Easier to manage for when we'll remove the beta badge in a few days.
Copy file name to clipboardExpand all lines: docusaurus/docs/dev-docs/configurations/typescript.md
+45-2Lines changed: 45 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,15 @@ description: How to configure Strapi for TypeScript development.
5
5
6
6
---
7
7
8
-
# TypeScript project configuration
8
+
# TypeScript configuration
9
9
10
-
[TypeScript](/dev-docs/typescript)-enabled Strapi applications have a specific [project structure](/dev-docs/project-structure) with the following dedicated folders and configuration files:
10
+
[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).
11
+
12
+
Strapi also has dedicated TypeScript features that are configured [in the `config/typescript.js|ts` file](#strapi-specific-configuration-for-typescript).
13
+
14
+
## Project structure and TypeScript-specific configuration files
15
+
16
+
TypeScript-enabled Strapi applications have a specific [project structure](/dev-docs/project-structure) with the following dedicated folders and configuration files:
11
17
12
18
| TypeScript-specific directories and files | Location | Purpose |
@@ -16,3 +22,40 @@ description: How to configure Strapi for TypeScript development.
16
22
|`tsconfig.json` file | application root | Manages TypeScript compilation for the server. |
17
23
|`tsconfig.json` file |`./src/admin/`| Manages TypeScript compilation for the admin panel. |
18
24
25
+
## Strapi-specific configuration for TypeScript <BetaBadge />
26
+
27
+
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.
28
+
29
+
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:
Copy file name to clipboardExpand all lines: docusaurus/docs/dev-docs/typescript.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,10 @@ yarn strapi ts:generate-types --verbose #optional flag
87
87
</TabItem>
88
88
</Tabs>
89
89
90
+
:::tip Tip: Automatically generate types
91
+
Types can be automatically generated on server restart by adding `autogenerate: true` to [the `config/typescript.js|ts` configuration file](/dev-docs/configurations/typescript#strapi-specific-configuration-for-typescript).
92
+
:::
93
+
90
94
## Develop a plugin using TypeScript
91
95
92
96
New plugins can be generated following the [plugins development documentation](/dev-docs/plugins-development). There are 2 important distinctions for TypeScript applications:
0 commit comments