type InputFields = Partial<InputHTMLAttributes<HTMLInputElement>>;
type SelectFields = Partial<SelectHTMLAttributes<HTMLSelectElement>>;
type OptionFields = Partial<OptionHTMLAttributes<HTMLOptionElement>>;
type BaseCustomFields<TDef extends ActionHandlerDef> = {
label: string;
name: keyof TDef['input'];
};
type InputCustomFields<TDef extends ActionHandlerDef> = BaseCustomFields<TDef> & {
tag?: 'input';
options?: never;
};
type SelectCustomFields<TDef extends ActionHandlerDef> = BaseCustomFields<TDef> & {
tag: 'select';
options: Array<OptionFields>;
};
type CustomFields<TDef extends ActionHandlerDef> = InputCustomFields<TDef> | SelectCustomFields<TDef>;
export type FieldElement<TDef extends ActionHandlerDef> = (InputFields | SelectFields) & CustomFields<TDef>;
export type FieldOptions<TDef extends ActionHandlerDef> = Partial<{
[K in keyof TDef['input']]: Partial<FieldElement<TDef>>;
}>;
export type CreateTRPCFormWithSchemaFieldsType<TDef extends ActionHandlerDef> = Array<FieldElement<TDef>>;