- Install the required packages
npm install
- Add you Directus API URL and account credentials to the package.json codegen script
- Run the codegen script
npm run codegen
- The generated types will be in the
types/directus.ts
file - Use the generated types in your code
import { Schema } from '../types/directus';
- You can try out the generate types in action using example in
src/index.ts
- Profit!