Skip to content

Commit 6ac11c3

Browse files
yyq1025claude
andcommitted
signaling: type TURN secrets via committed .d.ts (fix CI typecheck)
`wrangler types` only emits TURN_KEY_ID / TURN_API_TOKEN into the generated worker-configuration.d.ts when they're present in the local (gitignored) .env — so a dev machine typechecks but a fresh CI checkout doesn't, and `env.TURN_KEY_ID` fails. These are production-only secrets (set via `wrangler secret put`), never in wrangler.jsonc, so wrangler can't generate their types in CI by design. Declare them in a committed no-import .d.ts that merges into the global `Env` (typed `string` to match wrangler's own output, so the local generated declaration and this one coexist without conflict). No secret values committed; CI and dev both typecheck. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0d5a439 commit 6ac11c3

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

packages/signaling/src/env.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// TURN-minting secrets, set in production via `wrangler secret put`
2+
// (TURN_KEY_ID / TURN_API_TOKEN — see wrangler.jsonc). They are NOT in
3+
// wrangler.jsonc, and the only local source that feeds `wrangler types`
4+
// (a gitignored `.env`) is absent in CI — so the generated
5+
// `worker-configuration.d.ts` carries them on a dev machine but NOT in a
6+
// fresh CI checkout. Declaring them here merges them into the global `Env`
7+
// unconditionally, keeping `env.TURN_*` typed everywhere without ever
8+
// committing a value. A no-import .d.ts is a global script, so this
9+
// `interface Env` augments the generated one via declaration merging.
10+
interface Env {
11+
TURN_KEY_ID: string;
12+
TURN_API_TOKEN: string;
13+
}

0 commit comments

Comments
 (0)