Skip to content

feat: Export RunStatus type from @trigger.dev/sdk #4051

Description

@olivierbenard

Is your feature request related to a problem? Please describe.

I may be missing an existing exported type, so please feel free to redirect me if there is already a recommended way to type this.

Feature Request

It would be useful if @trigger.dev/sdk exported the public run status type, for example:

import type { RunStatus } from "@trigger.dev/sdk";

Use case example

I am building operational tooling around Trigger. In that context, I need to list runs by status and type status-based logic around runs.list(...) and runs.retrieve(...).

For example:

import { runs } from "@trigger.dev/sdk";
import type { RunStatus } from "@trigger.dev/sdk";

export async function* listTriggerRunsCreatedBetween(params: {
    createdAtFrom: Date;
    createdAtUntil: Date;
    status?: RunStatus[];
    detailed?: boolean;
}) {

    const listedRuns = runs.list({
        status: params.status,
        from: params.createdAtFrom,
        to: params.createdAtUntil,
    })

  for await (const run of listedRuns) {
      yield params.detailed ? await runs.retrieve(run.id) : run;
  }
}

Currently, RunStatus does not appear to be directly exported from @trigger.dev/sdk, so consumers need to derive it indirectly:

import { runs } from "@trigger.dev/sdk";

type Run = Awaited<ReturnType<typeof runs.retrieve>>;
type RunStatus = Run["status"];

These workarounds are usable, but they are less discoverable and couple application code to SDK method signatures rather than to an explicit public SDK type.

Describe the solution you'd like to see

Suggested API

import type { RunStatus } from "@trigger.dev/sdk";

Describe alternate solutions

Optionally, if the list filter type is intentionally different from the run object status type:

import type { RunListStatusFilter } from "@trigger.dev/sdk";

Additional information

Why this would help

This would improve TypeScript ergonomics for operational tooling such as run monitoring, ledgers, dashboards, queue inspection, backfills/replays, alerting and guardrails.

It's a small DX improvement but it would make the SDK easier to use for typed operational workflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions