cloudflare / cloudflare/workerd
Missing types for undefined jurisdiction
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
I'm using `.jurisdiction("eu")` on Durable Object namespaces and wanted to use the pattern described in #4745 and implmented in #4763 , passing `undefined` in local dev where workerd doesn't support jurisdiction:
```ts
const jurisdiction = env.WORKER_ENV ? "eu" : undefined;
env.MY_DO.jurisdiction(jurisdiction);
```
This works at runtime but fails TypeScript type checking because the generated types still require `DurableObjectJurisdiction` and don't accept `undefined`.
```ts
declare abstract class DurableObjectNamespace {
newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;
idFromName(name: string): DurableObjectId;
idFromString(id: string): DurableObjectId;
get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub;
getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub;
jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
}
type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
interface DurableObjectNamespaceNewUniqueIdOptions {
jurisdiction?: DurableObjectJurisdiction;
}
```
Had Claude Code look into it and it suspects the JSG_TS_OVERRIDE blocks in actor.h weren't updated to match the C++ signature change from this PR.
Contributor guide
Assessment
This issue has not been assessed yet.