Skip to content

Conversation

@naporin0624
Copy link
Member

Summary

  • Add worker-configuration.d.ts generated by Wrangler to fix Cloudflare Env type collision issue

Problem

As reported in #61, when extending YDurableObjects and exporting the class, there's a type collision where the Env interface points to node_modules instead of the project-specific Cloudflare.Env definitions in worker-configuration.d.ts.

Solution

  • Generated and committed worker-configuration.d.ts using wrangler types command
  • This file provides proper TypeScript declarations for the Cloudflare Workers environment
  • Ensures the correct Env interface is used for type checking

Test plan

  • Verify TypeScript compilation works correctly
  • Ensure Env properties are properly recognized by the compiler
  • Test that YDurableObjects extensions work without type conflicts

Fixes #61

🤖 Generated with Claude Code

naporin0624 and others added 7 commits August 5, 2025 08:11
Ignore MCP (Model Context Protocol) configuration file to keep it out of version control.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Add project-specific documentation to guide Claude Code when working with this repository. This includes:
- Common development commands (build, test, lint)
- Architecture overview of core components
- Development constraints and code style guidelines
- Testing approach and patterns

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

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Update devDependency from ^4.20250417.0 to latest
- Update peerDependency constraint from >=4.20240405.0 to latest

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

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Configure built dependencies handling for pnpm workspace

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

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Aug 5, 2025

🦋 Changeset detected

Latest commit: d119cec

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

naporin0624 and others added 6 commits August 5, 2025 08:23
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Generated files should not be formatted to avoid conflicts with tooling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Added watch mode for tests to improve development experience.

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Applied Prettier formatting for consistent markdown style
- Fixed list formatting and spacing issues
- Added proper line endings

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

Co-Authored-By: Claude <noreply@anthropic.com>
Added configuration for Serena AI development assistant:
- Project definition and TypeScript language setup
- Formatted configuration files according to project standards

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

Co-Authored-By: Claude <noreply@anthropic.com>
…onfig

Remove @cloudflare/workers-types/2023-07-01 and /experimental from the types
array in tsconfig.json as these packages are not installed and cause CI
type-checking failures. The worker-configuration.d.ts file generated by
Wrangler already provides the necessary Cloudflare Workers type definitions.

Fixes CI errors:
- TS2688: Cannot find type definition file for '@cloudflare/workers-types/2023-07-01'
- TS2688: Cannot find type definition file for '@cloudflare/workers-types/experimental'

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

Co-Authored-By: Claude <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 5, 2025

Deploying yjs-worker with  Cloudflare Pages  Cloudflare Pages

Latest commit: d119cec
Status: ✅  Deploy successful!
Preview URL: https://77812efd.yjs-worker.pages.dev
Branch Preview URL: https://issues-61.yjs-worker.pages.dev

View logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 5, 2025

Open in StackBlitz

npm i https://pkg.pr.new/napolab/y-durableobjects@62

commit: d119cec

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

📊 Package size report   2%↑

File Before After
package.json 3.1 kB -1.67%↓3.0 kB
README.md 8.2 kB 23%↑10.1 kB
Total (Includes all files) 88.7 kB 2%↑90.5 kB
Tarball size 17.6 kB 4%↑18.3 kB
Unchanged files
File Size
dist/chunk-44JZXIF7.js 379 B
dist/chunk-44JZXIF7.js.map 784 B
dist/chunk-GLWCU3YD.cjs 473 B
dist/chunk-GLWCU3YD.cjs.map 1.1 kB
dist/helpers/upgrade.cjs 216 B
dist/helpers/upgrade.cjs.map 258 B
dist/helpers/upgrade.d.cts 273 B
dist/helpers/upgrade.d.ts 273 B
dist/helpers/upgrade.js 107 B
dist/helpers/upgrade.js.map 71 B
dist/index.cjs 12.0 kB
dist/index.cjs.map 18.1 kB
dist/index.d.cts 4.8 kB
dist/index.d.ts 4.8 kB
dist/index.js 10.4 kB
dist/index.js.map 22.3 kB
LICENSE 1.1 kB

🤖 This report was automatically generated by pkg-size-action

naporin0624 and others added 3 commits August 5, 2025 09:17
Add comprehensive troubleshooting documentation for the Cloudflare.Env
type collision issue described in GitHub issue #61. The new section includes:

- Problem description: Empty Cloudflare.Env interface from @cloudflare/workers-types
  overwriting custom environment types
- Step-by-step solution: Check dependencies, clean install, and verify fix
- Reference to PR #62 where the issue was addressed
- Explanation of why residual dependencies may persist in lock files

This helps users resolve TypeScript type resolution issues when using
y-durableobjects with Cloudflare Workers and custom environment types.

Resolves documentation part of #61

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update the troubleshooting section to recommend using `wrangler types`
command (introduced in Wrangler v3) as the preferred approach for
generating TypeScript types for Cloudflare Workers.

Changes:
- Add "Recommended Approach" subsection explaining wrangler types
- Update reference from "wrangler@4" to "wrangler types" for accuracy
- Provide clear instructions for generating types with example command
- Emphasize that wrangler types generates accurate, up-to-date definitions

This addresses the modern best practice for Cloudflare Workers type
generation and helps users avoid type collision issues proactively.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Update the changeset description to better reflect the comprehensive
nature of the TypeScript support improvements in this patch release.

The updated description now includes:
- Detailed breakdown of all four major improvements made
- Clear explanation of CI failure fixes and type collision resolution
- Documentation of wrangler types adoption (introduced in Wrangler v3)
- Emphasis on automatic benefits for users without code changes
- Modern best practice guidance for Cloudflare Workers type generation

This provides clearer context for the release notes and helps users
understand the full scope of improvements included in this patch.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@naporin0624 naporin0624 merged commit 3675eb1 into main Aug 5, 2025
8 checks passed
@naporin0624 naporin0624 deleted the issues/61 branch August 5, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloudflare Env type collision

2 participants