jet-schema
Advanced tools
Comparing version 1.0.2 to 1.0.3
import jetSchema from './jetSchema'; | ||
export type { TSchemaFnObjArg as TJetSchema, PublicInferType as inferType, } from './jetSchema'; | ||
export { transform } from './util'; | ||
export declare const schema: <T, U extends import("./jetSchema").TSchemaFnObjArg<T> = import("./jetSchema").TSchemaFnObjArg<T>, R extends unknown extends T ? [isOptional?: boolean | undefined, isNullable?: boolean | undefined, defaultVal?: boolean | null | undefined] : undefined extends T ? null extends T ? [isOptional: true, isNullable: true, defaultVal?: boolean | (T & null) | undefined] : [isOptional: true, isNullable?: false | undefined, defaultVal?: boolean | undefined] : null extends T ? [isOptional: true, isNullable?: false | undefined, defaultVal?: true | (T & null) | undefined] : [isOptional?: false | undefined, isNullable?: false | undefined, defaultVal?: true | undefined] = unknown extends T ? [isOptional?: boolean | undefined, isNullable?: boolean | undefined, defaultVal?: boolean | null | undefined] : undefined extends T ? null extends T ? [isOptional: true, isNullable: true, defaultVal?: boolean | (T & null) | undefined] : [isOptional: true, isNullable?: false | undefined, defaultVal?: boolean | undefined] : null extends T ? [isOptional: true, isNullable?: false | undefined, defaultVal?: true | (T & null) | undefined] : [isOptional?: false | undefined, isNullable?: false | undefined, defaultVal?: true | undefined]>(schemaFnObjArg: U, ...rest: R) => import("./jetSchema").ISchema<unknown extends T ? R[0] extends infer T_1 ? T_1 extends R[0] ? T_1 extends true ? (R[1] extends infer T_2 ? T_2 extends R[1] ? T_2 extends true ? NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2]; }, undefined>> | null : NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2]; }, undefined>> : never : never) | undefined : R[1] extends infer T_2 ? T_2 extends R[1] ? T_2 extends true ? NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2]; }, undefined>> | null : NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? U[K] : never; }[K_2]; }, undefined>> : never : never : never : never : T>; | ||
export declare const schema: <T, U extends import("./jetSchema").TSchemaFnObjArg<T> = import("./jetSchema").TSchemaFnObjArg<T>, R extends unknown extends T ? [isOptional?: boolean | undefined, isNullable?: boolean | undefined, defaultVal?: boolean | null | undefined] : undefined extends T ? null extends T ? [isOptional: true, isNullable: true, defaultVal?: boolean | (T & null) | undefined] : [isOptional: true, isNullable?: false | undefined, defaultVal?: boolean | undefined] : null extends T ? [isOptional: true, isNullable?: false | undefined, defaultVal?: true | (T & null) | undefined] : [isOptional?: false | undefined, isNullable?: false | undefined, defaultVal?: true | undefined] = unknown extends T ? [isOptional?: boolean | undefined, isNullable?: boolean | undefined, defaultVal?: boolean | null | undefined] : undefined extends T ? null extends T ? [isOptional: true, isNullable: true, defaultVal?: boolean | (T & null) | undefined] : [isOptional: true, isNullable?: false | undefined, defaultVal?: boolean | undefined] : null extends T ? [isOptional: true, isNullable?: false | undefined, defaultVal?: true | (T & null) | undefined] : [isOptional?: false | undefined, isNullable?: false | undefined, defaultVal?: true | undefined]>(schemaFnObjArg: U, ...rest: R) => import("./jetSchema").ISchema<unknown extends T ? R[0] extends infer T_1 ? T_1 extends R[0] ? T_1 extends true ? (R[1] extends infer T_2 ? T_2 extends R[1] ? T_2 extends true ? NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2]; }, undefined>> | null : NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2]; }, undefined>> : never : never) | undefined : R[1] extends infer T_2 ? T_2 extends R[1] ? T_2 extends true ? NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2]; }, undefined>> | null : NonNullable<Exclude<{ [K_1 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] ? K_1 : never]?: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_1] | undefined; } & { [K_2 in keyof { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; } as undefined extends { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2] ? never : K_2]: { [K in keyof U]: U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends import("./util").TFunc ? U[K] extends infer T_3 ? T_3 extends U[K] ? T_3 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends import("./jetSchema").ISchema<unknown> ? U[K]["test"] extends infer T_4 ? T_4 extends U[K]["test"] ? T_4 extends (x: any) => x is infer U_1 ? U_1 : never : never : never : U[K] extends string | number ? { | ||
[x: string]: string | number; | ||
} | (((arg: unknown) => arg is U[K]) | [U[K], (arg: unknown) => arg is U[K]]) : never; }[K_2]; }, undefined>> : never : never : never : never : T>; | ||
export default jetSchema; |
@@ -35,3 +35,3 @@ import { TFunc } from './util'; | ||
test: (arg: unknown) => arg is T; | ||
pick: <K extends keyof T>(prop: K) => (null extends T[K] ? Partial<TPickRetVal<T[K]>> : undefined extends T[K] ? Partial<TPickRetVal<T[K]>> : never); | ||
pick: <K extends keyof T>(prop: K) => (null extends T[K] ? Partial<TPickRetVal<T[K]>> : undefined extends T[K] ? Partial<TPickRetVal<T[K]>> : TPickRetVal<T[K]>); | ||
_schemaSettings: { | ||
@@ -73,3 +73,3 @@ isOptional: boolean; | ||
type InferTypesHelper<U> = { | ||
[K in keyof U]: (U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends TFunc ? GetTypePredicate<U[K]> : U[K] extends ISchema<unknown> ? GetTypePredicate<U[K]['test']> : U[K] extends (string | number) ? U[K] : never); | ||
[K in keyof U]: (U[K] extends unknown[] ? U[K][0] : U[K] extends DateConstructor ? Date : U[K] extends TFunc ? GetTypePredicate<U[K]> : U[K] extends ISchema<unknown> ? GetTypePredicate<U[K]['test']> : U[K] extends (string | number) ? (TTypeArr<U[K]> | TEnum) : never); | ||
}; | ||
@@ -76,0 +76,0 @@ declare function jetSchema<M extends TDefaultValsMap<M>>(defaultValuesArr?: M extends [TFunc, unknown][] ? M : never, cloneFnArg?: TFunc): <T, U extends TSchemaFnObjArg<T> = TSchemaFnObjArg<T>, R extends TSchemaFnArgs<T> = TSchemaFnArgs<T>>(schemaFnObjArg: U, ...rest: R) => ISchema<unknown extends T ? InferTypes<U, R[0], R[1]> : T>; |
@@ -66,2 +66,3 @@ "use strict"; | ||
defaults[key] = () => cloneFn(vals[0]); | ||
console.log(vals); | ||
validators[key] = (arg) => vals.some(item => item === arg); | ||
@@ -68,0 +69,0 @@ } |
{ | ||
"name": "jet-schema", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple, typescript-first schema validation tool", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47653
402