API Reference

@cloudflare/workers-types

TypeScript type definitions for the Cloudflare Workers runtime, covering FetchEvent, KV, Durable Objects, and R2 bindings.

Official Documentation ↗
CompatibilityThis documentation covers version v4.20240909. Check the official docs for the latest API surface.

Installation

npmnpm install @cloudflare/workers-types

Methods

@cloudflare/workers-types is typescript type definitions for the cloudflare workers runtime, covering fetchevent, kv, durable objects, and r2 bindings. This page documents the core methods, installation, and common usage patterns for the current stable release.

Installation

Install @cloudflare/workers-types with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.

Core methods

The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v4.20240909 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.

Frequently asked questions

The faq section in the frontmatter answers the most common questions about @cloudflare/workers-types, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://developers.cloudflare.com/workers/languages/typescript/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:56.151Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://developers.cloudflare.com/workers/languages/typescript/ · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:56.151Z.

FAQ

Do I need tsconfig changes?
Add types: ["@cloudflare/workers-types"] to tsconfig.json; remove DOM and node libs.
Are Durable Objects typed?
Yes. DurableObjectNamespace and DurableObjectState are included in the types.
How do I version-match the runtime?
The package version mirrors the runtime date; update alongside wrangler.