svelidate
Version:
Simple and lightweight form validation for Svelte with no dependencies
18 lines (17 loc) • 1.65 kB
TypeScript
import type { HtmlCheckboxInputType, HtmlColorInputType, HtmlDateTimeInputType, HtmlFileInputType, HtmlNumberInputType, HtmlPseudoInputType, HtmlRadioInputType, HtmlStringInputType, SvelidateInputType } from "../../types/html";
import type { HtmlValidator, HtmlValidatorMapper } from "../../types/svelidate/validators";
declare type MapperMapFunction<T extends HtmlValidatorMapper<any>> = (inputType: NonNullable<Parameters<T>[0]>) => ReturnType<T>;
export declare type HtmlValidatorMapperMap = {
file: MapperMapFunction<HtmlValidatorMapper<HtmlFileInputType>>;
checkbox: MapperMapFunction<HtmlValidatorMapper<HtmlCheckboxInputType>>;
numbers: MapperMapFunction<HtmlValidatorMapper<HtmlNumberInputType>>;
dates: MapperMapFunction<HtmlValidatorMapper<HtmlDateTimeInputType>>;
strings: MapperMapFunction<HtmlValidatorMapper<HtmlStringInputType>>;
radio: MapperMapFunction<HtmlValidatorMapper<HtmlRadioInputType>>;
color: MapperMapFunction<HtmlValidatorMapper<HtmlColorInputType>>;
textarea: MapperMapFunction<HtmlValidatorMapper<Extract<HtmlPseudoInputType, "textarea">>>;
select: MapperMapFunction<HtmlValidatorMapper<Extract<HtmlPseudoInputType, "select-multiple" | "select-one">>>;
other: MapperMapFunction<HtmlValidatorMapper<Exclude<SvelidateInputType, HtmlPseudoInputType | HtmlFileInputType | HtmlCheckboxInputType | HtmlNumberInputType | HtmlDateTimeInputType | HtmlStringInputType | HtmlColorInputType | HtmlRadioInputType>>>;
};
export declare function getMatchingHtmlValidator(inputType: SvelidateInputType | undefined, htmlValidatorMapperMap: Partial<HtmlValidatorMapperMap>): HtmlValidator;
export {};