Skip to content

@pcvl/schema / StandaloneShape

Type Alias: StandaloneShape<Shape> ​

ts
type StandaloneShape<Shape> = { readonly [Key in keyof Shape as Shape[Key] extends StandaloneMarker ? Key : never]: Shape[Key] };

Defined in: schemas/objectInterpretedSchema.ts:98

The Standalone Keys of Shape, the fields .standalone() marked, with each one's own schema: what an object schema's shape holds. With no marked field, it is {}.

Type Parameters ​

Shape ​

Shape extends ObjectShape

Example ​

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

const shape = { email: pvl.string().standalone(), age: pvl.number() };

type Exposed = StandaloneShape<typeof shape>; // { readonly email: StringInterpretedSchema & StandaloneMarker }