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.

Nothing to do — TypeScript picks up requence-env.d.ts automatically and types the createService callback contextually:

createService('some-types', (ctx) => {
const name = ctx.input.name // typed from the input schema
return { number: 10 } // checked against the output schema
})
Option Default Description
--access-token Service access token (falls back to env / config file)
--dev-token Personal access token for branch-specific types
--watch false Watch for schema changes and regenerate automatically
--clear / --no-clear true Clear the terminal on watch updates

| Option | Default | Description | |—|—|—| | --outfile | requence-env.d.ts | Name 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:

bash 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.