Was this article helpful?
Thanks for your feedback
The tsgen plugin is a Contentstack CLI plugin that generates TypeScript typings from content types. The type file containing the TypeScript typings assists developers in working with content types in TypeScript.
With the tsgen plugin, you can annotate interfaces and fields with comments from the JSDoc library. Additionally, the tsgen plugin allows you to add prefixes to interfaces.
This step-by-step guide lets you install and use the tsgen plugin in CLI.
csdx plugin:install contentstack-cli-tsgen
csdx auth:tokens:add -d
Note: Skip this step if you already have a delivery token.
Usage
$ csdx tsgen
Options
Examples
$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts"
$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" -p "I"
$ csdx tsgen -a "delivery token alias" -o "contentstack/generated.d.ts" --no-doc
Was this article helpful?
Thanks for your feedback