Skip to content

Typing / CLI

Both the TypeScript and Python SDKs ship with a CLI that generates type definitions for your services. Types are derived from the schemas you defined in the Requence UI — input, configuration, and outputs — and kept in sync automatically.

Terminal window
npx requence-service generate-types

This creates a requence-env.d.ts file in your project root. TypeScript picks it up automatically — no import needed. Your ctx.input, ctx.configuration, and ctx.toOutput() calls will be fully typed.

OptionDefaultDescription
--access-tokenService access token (falls back to env / config file)
--dev-tokenPersonal access token for branch-specific types
--watchfalseWatch for schema changes and regenerate automatically
--clear / --no-cleartrueClear the terminal on watch updates
OptionDefaultDescription
--outfilerequence-env.d.tsName of the generated type file
--outdir.Directory to write the type file to

During development, use --watch to keep types in sync as you edit schemas in the Requence UI:

Terminal window
npx requence-service generate-types --watch

The CLI connects to Requence via server-sent events and regenerates types whenever a schema changes.

When using a dev token, the CLI generates types for the active branch instead of the published version. A comment is added to the generated files to indicate which branch the types belong to.