Developer tools
Find more about our XState CLI (Command Line Interface) and Chrome Devtools 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.