Types introspection
Types introspection allows you to retrieve the list of all flags and their variations, as well as the list of all context properties. This endpoint is used by the Tggl CLI to generate the TypeScript types but can be used for other purposes you might have.
The GET/typing endpoint returns a JSON object like the following:
Flags and variations
In the example above, flag flag_a
can have either values A or B when active, and flag flag_b
has a value of null when active.
The value of each flag is an array of all active variation values the flag has, they can be any JSON value including arrays and objects.
Context properties
Context properties are listed with their type. Each type is represented by a JSON value in the context, for instance the VERSION
type is represented by a string, the DATE
type is represented by a number or a string, etc. Some types have additional options like the SELECT
type which has a list of possible values.
In addition to the type, each property has a hidden
boolean property which indicates whether the property has been hidden or not from the dashboard.
Type | Represented by | Options |
---|---|---|
STRING | string | |
VERSION | string | |
NUMBER | number | |
STRING_ARRAY | string[] | |
DATE | string | number | |
BOOLEAN | boolean | |
SELECT | string | { options : { value: string }[] } |
Command line interface
You can use the Tggl CLI to generate the TypeScript types for your flags and context.
Specifying an output file using the -o
option that ends with *.d.ts
will generate a TypeScript declaration file for the Node.js SDK.
If you decide not to use the SDK you can specify a simple *.ts
file to only generate the interfaces.