Skip to content

ParsedEnv

ParsedEnv<S> = { [K in keyof S]: BindingTypeMap[S[K]["type"]] }

Defined in: packages/env/src/types.ts:185

Mapped type that resolves a Schema to its validated environment object.

Each key in the schema maps to the TypeScript type corresponding to its binding type (e.g., a d1 binding becomes D1Database, a "secret" becomes string).

S extends Schema

The env schema type.

const schema = {
DB: { type: "d1" as const },
API_KEY: { type: "secret" as const },
};
type Env = ParsedEnv<typeof schema>;
// { DB: D1Database; API_KEY: string }