mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-21 07:45:52 +00:00
fix(cloud-artifacts): make Env stubs actually take effect in CI
The previous stub file (2e29e362) wrapped `interface Env` in
`declare global { ... }`, but the file has no top-level import/export so
it's a script, not a module. TS2669 forbids `declare global` in scripts,
and in .d.ts files that error is silently swallowed — so the Env stubs
were never merged into the global scope. Locally typecheck passed only
because worker-configuration.d.ts (gitignored) provided Env separately;
in CI / fresh clones, `BUCKET`, `MAX_BYTES`, `DEFAULT_TTL_DAYS`,
`PUBLIC_URL` were all missing on Env.
Drop the wrapper. Top-level `interface Env` in a script .d.ts is already
global ambient and merges with worker-configuration.d.ts via interface
declaration merging, so both environments typecheck cleanly.
Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
20
packages/cloud-artifacts/src/types.d.ts
vendored
20
packages/cloud-artifacts/src/types.d.ts
vendored
@@ -90,13 +90,15 @@ interface ExportedHandler<Env = unknown> {
|
||||
// Wrangler-generated worker-configuration.d.ts supplies TOKEN via `wrangler secret put`.
|
||||
// This declaration provides the R2 binding + wrangler vars so the Worker compiles
|
||||
// without the generated file.
|
||||
|
||||
declare global {
|
||||
interface Env {
|
||||
BUCKET: R2Bucket
|
||||
TOKEN: string
|
||||
MAX_BYTES: string
|
||||
DEFAULT_TTL_DAYS: string
|
||||
PUBLIC_URL: string
|
||||
}
|
||||
//
|
||||
// NOTE: 这个文件是脚本(没有 top-level import/export),顶层 interface 自动是 global
|
||||
// ambient,会和 worker-configuration.d.ts 的 `interface Env` 走 interface declaration
|
||||
// merging。不要用 `declare global { ... }` 包裹——脚本文件里那种写法是 TS2669 错误,
|
||||
// 在 .d.ts 里甚至会被静默吞掉,导致 Env 桩完全不生效(CI 上就是这种情况)。
|
||||
interface Env {
|
||||
BUCKET: R2Bucket
|
||||
TOKEN: string
|
||||
MAX_BYTES: string
|
||||
DEFAULT_TTL_DAYS: string
|
||||
PUBLIC_URL: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user