Skip to content

fix(types): import KVNamespace explicitly in vike.d.ts - #90

Merged
Ardnived merged 1 commit into
mainfrom
claude/fix-types-kvnamespace-import
Sep 8, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/fix-types-kvnamespace-import

Conversation

@sydevs-bot

Copy link
Copy Markdown
Contributor

Summary

Two lines. types/vike.d.ts now imports KVNamespace from @cloudflare/workers-types instead of relying on an ambient global.

Why this is a separate PR

This is the one unadopted finding from #88's adversarial review. #88 merged at 15:09:59Z on fdb0c6b, about a minute before the fix was pushed to its branch, so the commit never entered main and the merged PR cannot carry it. Re-proposed here from the new main rather than reused.

The failure it prevents

types/vike.d.ts:67 declared WEMEDITATE_CACHE?: KVNamespace using the bare name. The file's only import was Locale, and tsconfig.json's types array names only vite/client and vike-react — so the name resolved through a global that some package in the dependency graph declares, not through anything this repo asks for.

That is harmless while the global keeps arriving, which is why tsc was green on both sides of #88. It is a Cannot find name 'KVNamespace' in a file nobody touched, on the day a transitive dependency stops declaring it.

It also made #88's own safety argument false. That PR claimed all three KVNamespace sites import the type explicitly, and concluded from this that nothing here depends on the package being ambient. Two sites did — server/kv-cache.ts:16 and server/cms-context.ts:14. This one did not.

Test results

  • Lean gate on f670c3d: ✓ .claude/skills/pr-prep/check.sh — lint (0 errors), tsc --noEmit, vitest run 49 files / 502 tests
  • Build on f670c3d: ✓ pnpm build
  • Targeted specs: none. The change is one type-only import. tsc covers it in full, and no spec can observe a type that erases at compile time.

Manual verification

Nothing. Nothing observable changed at runtime.

Notes for reviewer

Refs #84

🤖 Written by the sydevs autonomous loop — see what this is

🤖 Generated with Claude Code

https://claude.ai/code/session_01AoMqXwSLsdp88wc4Tc9qEj


Generated by Claude Code

`types/vike.d.ts:67` wrote a bare `KVNamespace`. The file's only import was
`Locale`, and `tsconfig.json`'s `types` array names only `vite/client` and
`vike-react`, so the name resolved through a global some package in the
dependency graph declares.

That made the PR's own safety argument false. It claims all three call sites
import the type explicitly, and therefore that nothing here depends on
`@cloudflare/workers-types` being ambient. Two sites did; this one did not.

The failure it prevents is a `Cannot find name 'KVNamespace'` in a file
nobody touched, the day that transitive global stops being declared. An
explicit import makes the resolution local and the claim true.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AoMqXwSLsdp88wc4Tc9qEj
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying wemeditate-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: f670c3d
Status: ✅  Deploy successful!
Preview URL: https://40794a8e.wm-design.pages.dev
Branch Preview URL: https://claude-fix-types-kvnamespace.wm-design.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web f670c3d Commit Preview URL

Branch Preview URL
Sep 08 2026, 03:19 PM

@Ardnived
Ardnived merged commit c566dac into main Sep 8, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in SYDevelopers Technical Roadmap Sep 8, 2026
@Ardnived
Ardnived deleted the claude/fix-types-kvnamespace-import branch September 8, 2026 15:49
@Ardnived Ardnived removed the awaiting label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants