-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathcloudflare-env.d.ts
More file actions
29 lines (25 loc) · 1.07 KB
/
Copy pathcloudflare-env.d.ts
File metadata and controls
29 lines (25 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Minimal, hand-written Cloudflare binding types for getCloudflareContext().env.
// We deliberately do NOT use `wrangler types` / @cloudflare/workers-types here:
// those globally override DOM types (e.g. Response.json() -> unknown), which
// breaks the browser-typed client code throughout this Next.js app.
interface D1Result<T = Record<string, unknown>> {
results: T[];
success: boolean;
}
interface D1PreparedStatement {
bind(...values: unknown[]): D1PreparedStatement;
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
run(): Promise<D1Result<never>>;
first<T = Record<string, unknown>>(): Promise<T | null>;
}
interface D1Database {
prepare(query: string): D1PreparedStatement;
batch<T = Record<string, unknown>>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
}
// Merged into OpenNext's global CloudflareEnv used by getCloudflareContext().
interface CloudflareEnv {
DB: D1Database;
ASSETS: { fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> };
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: string;
CLERK_SECRET_KEY: string;
}