Generate TypeScript typings from a Stack.
npm install contentstack-cli-tsgen``shell`
$ csdx plugins:install contentstack-cli-tsgen
$ csdx tsgen
generate TypeScript typings from a Stack
`
USAGE
$ csdx tsgen
OPTIONS
-a, --token-alias=token-alias (required) delivery token alias
-d, --[no-]doc include documentation comments
-o, --output=output (required) full path to output
-p, --prefix=prefix interface prefix, e.g. "I"
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
`
_See code: src/commands/tsgen.ts_
typescript
/* This is a description. /
interface BuiltinExample {
/* Title /
title: string;
/* URL /
url: string;
/* Group1 /
group1?: {
/* Group2 /
group2?: {
/* Group3 /
group3?: {
/* Number /
number?: number;
};
};
};
/* SEO /
seo?: Seo;
/* Single line textbox /
single_line?: string;
/* Multi line textbox /
multi_line?: string;
/* Rich text editor /
rich_text_editor?: string;
/* Multiple Single Line Textbox /
multiple_single_line_textbox?: string[];
/* Markdown /
markdown?: string;
/* Multiple Choice /
multiple_choice?: ("Choice 1" | "Choice 2" | "Choice 3")[];
/* Single Choice /
single_choice: "Choice 1" | "Choice 2" | "Choice 3";
/* Modular Blocks /
modular_blocks?:ModularBlocks[];
/* Number /
number?: number;
/* Link /
link?: Link;
/* File /
file?: File;
/* Boolean /
boolean?: boolean;
/* Date /
date?: string;
}interface ModularBlocks {
block_1: {
/* Number /
number?: number;
/* Single line textbox /
single_line?: string;
};
block_2: {
/* Boolean /
boolean?: boolean;
/* Date /
date?: string;
};
seo_gf: {
/* Keywords /
keywords?: string;
/* Description /
description?: string;
};
}
``