Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

cloudflare-shim.d.ts

33 lines1.7 KB

1/* eslint-disable @typescript-eslint/consistent-type-imports --
2 global declaration file: a top-level import would turn it into a module */
3// Companion to the wrangler-generated worker-configuration.d.ts (env-only
4// mode — `bun run types`). Full runtime-type generation clashes with lib.dom
5// in this single-tsconfig SSR app, so binding types are aliased from
6// @cloudflare/workers-types as type-only imports (no fetch/Response globals),
7// and the cloudflare:workers module is declared against the generated
8// Cloudflare.Env so bindings/vars/secrets stay auto-generated.
9type KVNamespace = import('@cloudflare/workers-types').KVNamespace
10type D1Database = import('@cloudflare/workers-types').D1Database
11type ExecutionContext = import('@cloudflare/workers-types').ExecutionContext
12type SendEmail = import('@cloudflare/workers-types').SendEmail
13type ScheduledController =
14 import('@cloudflare/workers-types').ScheduledController
15​
16declare module 'cloudflare:workers' {
17 export const env: Cloudflare.Env
18​
19 /** Extends the current request's lifetime past the response (workerd-native). */
20 export function waitUntil(promise: Promise<unknown>): void
21​
22 /** Durable Object base class (US_EGRESS, `src/server/us-egress-object.ts`). */
23 export const DurableObject: typeof import('@cloudflare/workers-types').CloudflareWorkersModule.DurableObject
25​
26type DurableObjectNamespace<
27 T extends
28 | import('@cloudflare/workers-types').Rpc.DurableObjectBranded
29 | undefined = undefined,
30> = import('@cloudflare/workers-types').DurableObjectNamespace<T>
31​
32/** Cloudflare Browser Rendering binding; keep runtime globals scoped. */
33type BrowserRun = import('@cloudflare/workers-types').BrowserRun