---
title: Generated types
description: "sproutboat types writes sproutboat-env.d.ts so env and the handler are fully typed."
---

`env` is a global, so an editor has nothing to infer from: `env.SESSIONS` is an undeclared identifier until you generate types.

<CodeGroup>

```sh Bun
bunx sproutboat types      # writes sproutboat-env.d.ts
```

```sh npm
npx sproutboat types       # writes sproutboat-env.d.ts
```

</CodeGroup>

The file declares one property per binding, typed by kind, and references the binding shapes shipped with the CLI. Commit it, and add it to your tsconfig's `include`.

:::note
`dev` and `deploy` rewrite `sproutboat-env.d.ts` when `sproutboat.jsonc` is newer, so a binding you just added shows up without asking; neither writes into a project with no `tsconfig.json`.
:::

## Handler typing

Generated types also type the handler itself, which catches the Workers habit of passing `env` as a parameter:

```ts
export default {
  // error: env is a global, not a parameter. Second param is ctx, not env.
  fetch(request, env, ctx) { /* ... */ },
} satisfies SproutboatHandler;
```
