Skip to content

@pcvl/schema / StandaloneElement

Type Alias: StandaloneElement<ItemSchema> ​

ts
type StandaloneElement<ItemSchema> = ItemSchema extends StandaloneMarker ? ItemSchema : undefined;

Defined in: schemas/arrayInterpretedSchema.ts:23

What an array schema's element holds: its item schema when .standalone() marked it, and undefined otherwise, as an object schema's shape holds only its marked fields.

Type Parameters ​

ItemSchema ​

ItemSchema

Example ​

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

const tag = pvl.string().standalone();

type Exposed = StandaloneElement<typeof tag>; // StringInterpretedSchema & StandaloneMarker
type Hidden = StandaloneElement<ReturnType<typeof pvl.string>>; // undefined