UNPKG

@typeofweb/schema

Version:

`@typeofweb/schema` is a lightweight and extensible library for data validation with full TypeScript support!

3 lines 2.01 kB
import type { SomeSchema, Primitives } from '../types'; export declare const tuple: <U extends readonly (SomeSchema<any> | Primitives)[]>(validatorsOrLiterals: readonly [...U]) => <S extends SomeSchema<unknown>>(schema?: S | undefined) => SomeSchema<import("../types").Pretty<import("../types").If<true, unknown extends { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } ? false : { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } extends never ? false : {} extends { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } ? true : true, S["__type"] extends readonly (infer TypeOfSchemaElement)[] ? { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } extends readonly [...infer _] ? { readonly [Index_1 in keyof (readonly [..._] & { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; })]: TypeOfSchemaElement; } : { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } : { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; }, never>> | import("../types").Pretty<import("../types").If<false, unknown extends { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } ? false : { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } extends never ? false : {} extends { readonly [Index in keyof U]: U[Index] extends SomeSchema<any> ? import("../types").Pretty<U[Index]["__type"]> : U[Index]; } ? true : true, S["__type"], never>>>; //# sourceMappingURL=tuple.d.ts.map