Skip to content

@pcvl/schema / ObjectOutput

Type Alias: ObjectOutput<Shape> ​

ts
type ObjectOutput<Shape> = ComposeObject<{ [Key in keyof Shape]: InferOutput<Shape[Key]> }>;

Defined in: schemas/objectInterpretedSchema.ts:80

The object type a successful validation hands back, composed from each field schema's own output type. It lists the declared keys only; .passthrough() adds an unknown-valued index signature alongside them.

Type Parameters ​

Shape ​

Shape extends ObjectShape

Example ​

ts
import { pvl, type ObjectOutput } from '@pcvl/schema';

const shape = { name: pvl.string(), age: pvl.string().transform(Number) };

type User = ObjectOutput<typeof shape>; // { name: string; age: number }