Create typescript types from any directus api. Forked from: https://github.com/elierotenberg/directus-typescript-gen
yarn add -D @devix-tecnologia/directus2ts
yarn directus2ts --host <directus-host> --token <auth-token> --typeName <group-name> --prefix <prefix-collection> --outFile <output-file.d.ts> --simplified
The simplified option generates a smaller file without too much pollution. It is suitable for most uses.
import { Directus } from "@directus/sdk";
import { MyCollections } from "./my-collections.d.ts";
const directus = new Directus<MyCollections>();