Skip to content

Commit 9381ab2

Browse files
Merge pull request #1975 from strapi/dev/autogenerate-updates
Update docs for autogenerate settings for JS projects
2 parents 9979c26 + 8789a52 commit 9381ab2

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

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

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,20 @@ TypeScript-enabled Strapi applications have a specific [project structure](/dev-
2424

2525
## Strapi-specific configuration for TypeScript
2626

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

33-
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:
29+
To avoid having to [manually generate types](/dev-docs/typescript#generate-typings-for-project-schemas) every time the server restarts, TypeScript-based projects autogenerate the types for you. However, generating types is not a requirement for JavaScript-based projects, so if you want you can turn types autogeneration off by creating an optional `config/typescript.js|ts` configuration file and setting the `autogenerate` parameter to `false`:
3430

3531
| Parameter | Description | Type | Default |
3632
| -------------- | -------------------------------------------------------------- | --------- | ------- |
37-
| `autogenerate` | Enable or disable automatic types generation on server restart | `Boolean` | `false` |
38-
39-
**Example:**
40-
41-
<Tabs groupId="js-ts">
42-
43-
<TabItem value="javascript" label="JavaScript">
33+
| `autogenerate` | Enable or disable automatic types generation on server restart | `Boolean` | `true` |
4434

4535
```js title="./config/typescript.js"
4636
module.exports = ({ env }) => ({
47-
autogenerate: true,
48-
});
49-
```
50-
51-
</TabItem>
52-
53-
<TabItem value="typescript" label="TypeScript">
54-
55-
```ts title="./config/typescript.ts"
56-
export default ({ env }) => ({
57-
autogenerate: true,
37+
autogenerate: false,
5838
});
5939
```
6040

61-
</TabItem>
62-
63-
</Tabs>
41+
:::caution 🚧 Experimental.
42+
Turning off types autogeneration for JavaScript projects is considered experimental and might have issues or break some features.
43+
:::

docusaurus/docs/dev-docs/typescript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ yarn strapi ts:generate-types --debug #optional flag to display additional loggi
8585
</TabItem>
8686
</Tabs>
8787

88-
:::tip Tip: Automatically generate types
89-
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).
88+
:::tip Tip: Types generation for JavaScript projects
89+
For JavaScript projects, automatic types generation can be turned off (see [`config/typescript.js` documentation](/dev-docs/configurations/typescript#strapi-specific-configuration-for-typescript)).
9090
:::
9191

9292
:::tip Tip: Using types in your front-end application

0 commit comments

Comments
 (0)