Importing types
All types are available as named exports from the maincloudflare package:
Request parameter types
Request parameter types follow the naming convention[Resource][Method]Params:
Response types
Response types are named after the resource they represent:Type safety benefits
Using TypeScript types provides several benefits:Autocomplete
Get intelligent code completion for all API methods and parameters
Compile-time checking
Catch errors before runtime with TypeScript’s type checker
Documentation
See inline documentation for parameters and return types
Refactoring
Safely refactor code with confidence in type correctness
Partial types
You can use TypeScript’s utility types to create partial or custom types:Generic types
The library also exports common types used across the API:All types are automatically generated from the Cloudflare OpenAPI specification and are kept up-to-date with the latest API changes.