directus-extension-ts-typegen
A Directus extension that automatically generates TypeScript types for your Directus schema, making it easier to work with your Directus data in a type-safe manner.
This extensions features support for O2M, M2O, M2M and M2A relations.
Installation
This extension can be installed in multiple ways:
Via Directus Marketplace
- Navigate to your Directus admin panel
- Go to Settings → Marketplace
- Search for “directus-extension-ts-typegen”
- Click “Install Extension”
Via npm (Docker Setup)
Add the extension to your Directus Dockerfile. For detailed installation instructions, refer to the official Directus documentation.
Requirements: Directus >= 10.10.0
Basic Usage
- After installation, navigate to your Directus admin panel
- Enable the TS Typegen module under settings → modules
- Look for the new TS Typegen module in your sidebar
- Copy the generated TypeScript types (and change any of the options)
- Paste them into your project
The generated types will reflect your current Directus schema and can be used with the Directus SDK for full type safety in your applications.
Credits
- directus-extension-generate-types - Initial inspiration for this project
License
Published under the MIT License.
Need help or found a bug? Please open an issue on the project repository.