UNPKG

690 BTypeScriptView Raw
1import { Component, FormHTMLAttributes } from "react";
2import { FormSubmitHandler, Omit } from "../index";
3
4interface FormSubmitProp<FormData = {}, P = {}, ErrorType = string> {
5 onSubmit?: FormSubmitHandler<FormData, P, ErrorType> | undefined;
6}
7
8export type FormProps<FormData, P, ErrorType = string> =
9 & Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit">
10 & FormSubmitProp<FormData, P, ErrorType>;
11
12export class GenericForm<FormData, P, ErrorType> extends Component<FormProps<FormData, P, ErrorType>> {}
13
14export class Form<FormData = {}, P = {}, ErrorType = string> extends Component<FormProps<FormData, P, ErrorType>>
15 implements GenericForm<FormData, P, ErrorType>
16{
17}