Skip to content

devix-tecnologia/directus2ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directus2Ts

Create typescript types from any directus api. Forked from: https://github.com/elierotenberg/directus-typescript-gen

Installation

  yarn add -D @devix-tecnologia/directus2ts

Usage

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.

Instancing the Directus SDK

import { Directus } from "@directus/sdk";
import { MyCollections } from "./my-collections.d.ts";

const directus = new Directus<MyCollections>();