Skip to content

Conversation

@agents-git-bot
Copy link
Contributor

@agents-git-bot agents-git-bot bot commented Dec 1, 2025

Summary

Syncs documentation updates from cloudflare/sandbox-sdk#264.

This PR documents the TypeScript generic type parameters added to getSandbox(), SandboxEnv, and proxyToSandbox() that fix type errors when extending the Sandbox class with custom methods.

Changes

  • API Reference - Lifecycle: Updated getSandbox() signature to show generic type parameter <T extends Sandbox<any>>
  • API Reference - Lifecycle: Added comprehensive section on "Extending the Sandbox class" with code example showing how to create custom Sandbox subclasses
  • API Reference - Ports: Added full documentation for proxyToSandbox() function including generic type parameters
  • Type Helpers: Documented SandboxEnv<T> type helper for defining environment types with custom Sandbox classes

Why These Changes

The original PR fixed a TypeScript type error where users extending the Sandbox class would get type errors when passing their namespace to getSandbox() and proxyToSandbox(). The functions and types are now generic to properly support extended classes.

This documentation update:

  1. Shows developers the correct type signatures
  2. Explains how to use the generic type parameters
  3. Provides a complete working example of extending Sandbox
  4. Ensures type safety is maintained when using custom Sandbox classes

Related Links

🤖 Auto-generated PR from cloudflare/sandbox-sdk documentation sync workflow

Update API documentation to reflect TypeScript generic type parameters
added to getSandbox(), SandboxEnv, and proxyToSandbox(). These changes
fix type errors when extending the Sandbox class with custom methods.

Changes:
- Update getSandbox() signature to show generic type parameter
- Add section on extending Sandbox class with example
- Document proxyToSandbox() function with generic types
- Document SandboxEnv type helper for custom Sandbox classes

Related to cloudflare/sandbox-sdk#264

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/sandbox/ @whoiskatrin, @ghostwriternr, @cloudflare/pcx-technical-writing, @cloudflare/ai-agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants