fix(striker-ui): relocate formik utils type

main
Tsu-ba-me 11 months ago
parent 82ab298dc6
commit 1713ea4de7
  1. 10
      striker-ui/hooks/useFormikUtils.ts
  2. 12
      striker-ui/types/FormikUtils.d.ts

@ -7,15 +7,7 @@ import getFormikErrorMessages from '../lib/getFormikErrorMessages';
const useFormikUtils = <Values extends FormikValues = FormikValues>( const useFormikUtils = <Values extends FormikValues = FormikValues>(
...formikArgs: Parameters<UseFormik<Values>> ...formikArgs: Parameters<UseFormik<Values>>
): { ): FormikUtils<Values> => {
disableAutocomplete: (
overwrite?: Partial<OutlinedInputProps>,
) => OutlinedInputProps;
disabledSubmit: boolean;
formik: Formik<Values>;
formikErrors: Messages;
handleChange: FormikChangeHandler<Values>;
} => {
const [formikConfig, ...restFormikArgs] = formikArgs; const [formikConfig, ...restFormikArgs] = formikArgs;
const formik = useFormik<Values>({ ...formikConfig }, ...restFormikArgs); const formik = useFormik<Values>({ ...formikConfig }, ...restFormikArgs);

@ -10,3 +10,15 @@ type FormikChangeHandler<Values extends FormikValues> =
type FormikSubmitHandler<Values extends FormikValues> = type FormikSubmitHandler<Values extends FormikValues> =
import('formik').FormikConfig<Values>['onSubmit']; import('formik').FormikConfig<Values>['onSubmit'];
type FormikUtils<Values extends FormikValues> = {
disableAutocomplete: (
overwrite?: Partial<
import('../components/OutlinedInput').OutlinedInputProps
>,
) => import('../components/OutlinedInput').OutlinedInputProps;
disabledSubmit: boolean;
formik: Formik<Values>;
formikErrors: Messages;
handleChange: FormikChangeHandler<Values>;
};

Loading…
Cancel
Save