Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docusaurus/docs/cms/typescript/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ Strapi provides typings on the `Strapi` class to enhance the TypeScript developm
To experience TypeScript-based autocomplete while developing Strapi applications, you could try the following:

1. Open the `./src/index.ts` file from your code editor.
2. Declare the `strapi` argument as type `Strapi` within the global `register` method:
2. Declare the `strapi` argument with the `Core.Strapi` type exported from `@strapi/strapi` within the global `register` method:

```typescript title="./src/index.ts"
import { Strapi } from '@strapi/strapi';
import type { Core } from '@strapi/strapi';

export default {
register({ strapi }: { strapi: Strapi }) {
register({ strapi }: { strapi: Core.Strapi }) {
// ...
},
};
```

The `Core` namespace re-exported by `@strapi/strapi` exposes the `Strapi` type that powers TypeScript autocompletion while keeping the runtime import free of unused bindings.

3. Within the body of the `register` method, start typing `strapi.` and use keyboard arrows to browse the available properties.

4. Choose `runLifecyclesFunctions` from the list.
Expand Down