Generate TypeScript types for your bindings

setup & auth

// what it does

Reads your wrangler config and writes worker-configuration.d.ts with an `Env` interface typed to your exact bindings (KV, R2, D1, vars, Hyperdrive, Queues...) plus the Workers runtime types, so `env.MY_KV` is autocompleted and type-checked. Run it after every binding change; `--check` verifies the file is current without rewriting it — handy as a CI lint.

// shell

$ wrangler types
$ wrangler types --check

// gotcha

The types are only as fresh as your last run — add a binding and forget to regenerate and TypeScript won't know about it. Commit the generated file and ensure tsconfig includes it; runtime types track your `compatibility_date`, so a stale date yields stale globals.