Skip to content

Generating Types

You can generate types for your Flowcore project from your streams using the Flowcore CLI.

Installation

You can install this plugin to the Flowcore CLI by running the following command:

Terminal window
flowcore plugins install @flowcore/cli-plugin-types

JSON Schema

You can generate a JSON Schema from your Flowcore streams using the flowcore types <STREAM> command. This command will generate a JSON Schema for using a collection of events from a stream.

Terminal window
flowcore types <STREAM> --last <N> --directory <DIRECTORY>

This command will generate a JSON Schema from a collection of events from a stream prioritzing more recent events over older events.

TypeScript Types

You can generate TypeScript types for your Flowcore streams using the flowcore types typescript <STREAM> command. This command will use the JSON Schema to generate TypeScript types for the events in the stream.