Skip to content

@pcvl/schema / ObjectShape

Type Alias: ObjectShape ​

ts
type ObjectShape = Readonly<Record<string, Schema<unknown, unknown>>>;

Defined in: schemas/objectInterpretedSchema.ts:27

The field schemas an object schema composes, one per declared key. A field is any @pcvl/schema Schema — including a transformed or compiled one — but never a schema from another library.

Example ​

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

const shape = {
  name: pvl.string(),
  age: pvl.number().int(),
} satisfies ObjectShape;

const user = pvl.object(shape);