UNPKG

@codethread/tstl-validate

Version:

Fork and adaptation of valibot for use in typescript-to-lua

23 lines (22 loc) 745 B
/** @noSelfInFile */ import type { BaseSchema, Input, Output } from "../../types"; /** * Non nullable type. */ export type NonNullable<T> = T extends null ? never : T; /** * Non nullable schema type. */ export type NonNullableSchema<TWrappedSchema extends BaseSchema, TOutput = NonNullable<Output<TWrappedSchema>>> = BaseSchema<NonNullable<Input<TWrappedSchema>>, TOutput> & { schema: "non_nullable"; wrapped: TWrappedSchema; }; /** * Creates a non nullable schema. * * @param wrapped The wrapped schema. * @param error The error message. * * @returns A non nullable schema. */ export declare function nonNullable<TWrappedSchema extends BaseSchema>(wrapped: TWrappedSchema, error?: string): NonNullableSchema<TWrappedSchema>;