Repository navigation
fix(types): import KVNamespace explicitly in vike.d.ts - #90
Merged
Merged
Conversation
`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
Deploying wemeditate-design with
|
| 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 |
Deploying with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two lines.
types/vike.d.tsnow importsKVNamespacefrom@cloudflare/workers-typesinstead 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:59Zonfdb0c6b, about a minute before the fix was pushed to its branch, so the commit never enteredmainand the merged PR cannot carry it. Re-proposed here from the newmainrather than reused.The failure it prevents
types/vike.d.ts:67declaredWEMEDITATE_CACHE?: KVNamespaceusing the bare name. The file's only import wasLocale, andtsconfig.json'stypesarray names onlyvite/clientandvike-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
tscwas green on both sides of #88. It is aCannot 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
KVNamespacesites import the type explicitly, and concluded from this that nothing here depends on the package being ambient. Two sites did —server/kv-cache.ts:16andserver/cms-context.ts:14. This one did not.Test results
f670c3d: ✓.claude/skills/pr-prep/check.sh— lint (0 errors),tsc --noEmit,vitest run49 files / 502 testsf670c3d: ✓pnpm buildtsccovers 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
import type, so it erases entirely and adds nothing to the Worker bundle.wrangler types, and drop the hand-picked@cloudflare/workers-types#89 would remove the need for this file to name the type at all —wrangler typesgeneratesWEMEDITATE_CACHEfromwrangler.toml's binding. This fix stands on its own until then, and does not conflict with it.@cloudflare/workers-typesto major 5, matching the wrangler that emulates the runtime #88 (comment)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