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

cloudflare-shim.d.ts

24 lines1.3 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
22​
23/** Cloudflare Browser Rendering binding; keep runtime globals scoped. */
24type BrowserRun = import('@cloudflare/workers-types').BrowserRun