export type DataShape = T extends StringConstructor | NumberConstructor | BooleanConstructor ? ReturnType : T extends abstract new (...args: any) => any ? InstanceType : T extends Optional ? DataShape | undefined : T extends (infer Item)[] ? DataShape[] : T extends Object ? { [key in keyof T]: DataShape; } : never declare class Optional { type: T } /** * Parses 'unknown' data using shape requirements. */ export function parse(shape: T, data: any): DataShape /** * Marks a value optional during parsing. */ export function optional(value: T): Optional declare class Shape { definition: T parse(data: any): ReturnType> } /** * Creates a reusable parse instance, specifying the shape to parse. */ export function shape(definition: T): Shape