Skip to content
sproutboat
Esc
↑↓navigate↵open⌘Jpreview
On this page

Generated types

sproutboat types writes sproutboat-env.d.ts so env and the handler are fully typed.

sproutboat types declares your project’s binding names and shapes, so your editor can check env.SESSIONS and the handler’s parameters.

bunx sproutboat types      # writes sproutboat-env.d.ts
npx sproutboat types       # writes sproutboat-env.d.ts

The file declares a global env with one property per binding, typed by kind, and references the binding types shipped with the CLI. Commit it, and add it to your tsconfig’s include.

Handler typing

With a compatibility_date of 2026-09-28 or later, the handler receives (request, env, ctx). Type it with WorkersHandler:

export default {
  fetch(request, env, ctx) {
    return new Response(env.SITE);
  },
} satisfies WorkersHandler<typeof env>;

With an earlier date, the handler receives (request, ctx); type it with SproutboatHandler.

Was this page helpful?