Skip to content
Version: XState v4

Developer tools

Find more about our XState CLI (Command Line Interface) below. We plan to make extensions for more IDEs (Integrated Development Environments) in the future.

XState CLI (Command Line Interface)​

The @xstate/cli (Command Line Interface) package contains commands for running typegen. The package is small right now, but we plan to add more features.

Installation​

Run npm install @xstate/cli.

Commands​

xstate typegen <files>​

Use the following command to run the typegen against a glob.

xstate typegen "src/**/*.ts?(x)"

Running typegen will scan every targeted file and generate a typegen file to accompany it. It will also import the typegen into your file, as described in our typegen documentation.

Options​

xstate typegen "src/**/*.ts?(x)" --watch

Runs the task on a watch, monitoring for changed files and running the typegen script against them.