import { Parser } from "./index"; import { IParser, OnParse } from "./interfaces"; type _ = T; export type MergeAll = T extends Array ? Array> : T extends object ? T extends null | undefined | never ? T : _<{ [k in keyof T]: MergeAll; }> : T; /** * Given an object, we want to make sure the key exists and that the value on * the key matches the parser */ export declare class ShapeParser implements IParser { readonly parserMap: { [key in keyof B]: Parser; }; readonly isPartial: boolean; readonly parserKeys: Array; readonly description: { readonly name: "Partial" | "Shape"; readonly children: { [key in keyof B]: Parser; }[string & keyof B][]; readonly extras: (string & keyof B)[]; }; constructor(parserMap: { [key in keyof B]: Parser; }, isPartial: boolean, parserKeys?: Array, description?: { readonly name: "Partial" | "Shape"; readonly children: { [key in keyof B]: Parser; }[string & keyof B][]; readonly extras: (string & keyof B)[]; }); parse(a: A, onParse: OnParse): C | D; } export declare const isPartial: (testShape: { [key in keyof A]: Parser; }) => Parser>; /** * Good for duck typing an object, with optional values * @param testShape Shape of validators, to ensure we match the shape */ export declare const partial: (testShape: { [key in keyof A]: Parser; }) => Parser>; /** * Good for duck typing an object * @param testShape Shape of validators, to ensure we match the shape */ export declare const isShape: (testShape: { [key in keyof A]: Parser; }) => Parser; export type OptionalKeys = { [K in keyof Obj]: undefined extends Obj[K] ? K : never; }[keyof Obj]; export type WithOptionalKeys = MergeAll<{ [K in keyof Omit>]: Obj[K]; } & { [K in OptionalKeys]?: Obj[K]; }>; export declare function shape(testShape: { [key in keyof A]: Parser; }): Parser>; export {};