fix(striker-ui): resolve type errors during build

main
Tsu-ba-me 11 months ago
parent ac4571f321
commit 4c7792f17b
  1. 2
      striker-ui/components/ManageMailRecipient/AlertOverrideInputGroup.tsx
  2. 4
      striker-ui/components/ManageMailRecipient/ManageAlertOverride.tsx
  3. 8
      striker-ui/hooks/useFormikUtils.ts

@ -118,7 +118,7 @@ const AlertOverrideInputGroup: FC<AlertOverrideInputGroupProps> = (props) => {
if (alertOverride.uuids) { if (alertOverride.uuids) {
formik.setFieldValue(removeChain, true, true); formik.setFieldValue(removeChain, true, true);
} else { } else {
formik.setValues((previous) => { formik.setValues((previous: MailRecipientFormikValues) => {
const shallow = { ...previous }; const shallow = { ...previous };
const { [mrUuid]: mr } = shallow; const { [mrUuid]: mr } = shallow;
const { [aoVid]: remove, ...keep } = mr.alertOverrides; const { [aoVid]: remove, ...keep } = mr.alertOverrides;

@ -31,7 +31,7 @@ const ManageAlertOverride: FC<ManageAlertOverrideProps> = (props) => {
* _n_ is the number of subnodes per node. */ * _n_ is the number of subnodes per node. */
const valueId = uuidv4(); const valueId = uuidv4();
formik.setValues((previous) => { formik.setValues((previous: MailRecipientFormikValues) => {
const shallow = { ...previous }; const shallow = { ...previous };
const { [mrUuid]: mr } = shallow; const { [mrUuid]: mr } = shallow;
@ -43,7 +43,7 @@ const ManageAlertOverride: FC<ManageAlertOverrideProps> = (props) => {
return shallow; return shallow;
}); });
}} }}
renderListItem={(valueId, value) => renderListItem={(valueId, value: AlertOverrideFormikAlertOverride) =>
!value.remove && ( !value.remove && (
<AlertOverrideInputGroup <AlertOverrideInputGroup
alertOverrideTargetOptions={alertOverrideTargetOptions} alertOverrideTargetOptions={alertOverrideTargetOptions}

@ -1,16 +1,14 @@
import { OutlinedInputProps } from '@mui/material'; import { OutlinedInputProps } from '@mui/material';
import { FormikValues, useFormik } from 'formik'; import { FormikConfig, FormikValues, useFormik } from 'formik';
import { useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import debounce from '../lib/debounce'; import debounce from '../lib/debounce';
import getFormikErrorMessages from '../lib/getFormikErrorMessages'; import getFormikErrorMessages from '../lib/getFormikErrorMessages';
const useFormikUtils = <Values extends FormikValues = FormikValues>( const useFormikUtils = <Values extends FormikValues = FormikValues>(
...formikArgs: Parameters<UseFormik<Values>> formikConfig: FormikConfig<Values>,
): FormikUtils<Values> => { ): FormikUtils<Values> => {
const [formikConfig, ...restFormikArgs] = formikArgs; const formik = useFormik<Values>({ ...formikConfig });
const formik = useFormik<Values>({ ...formikConfig }, ...restFormikArgs);
const getFieldChanged = useCallback( const getFieldChanged = useCallback(
(field: string) => { (field: string) => {

Loading…
Cancel
Save