Skip to content

Commit

Permalink
tidy imports & types
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Nov 4, 2024
1 parent 240e849 commit 74ab724
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/Checklist/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import FormControlLabel from "@mui/material/FormControlLabel";
import IconButton from "@mui/material/IconButton";
import Switch from "@mui/material/Switch";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import { FormikErrors, FormikValues, useFormik } from "formik";
import adjust from "ramda/src/adjust";
import compose from "ramda/src/compose";
import remove from "ramda/src/remove";
Expand Down Expand Up @@ -313,7 +313,7 @@ export const ChecklistComponent: React.FC<ChecklistProps> = (props) => {
}
},
validate: ({ options, ...values }) => {
const errors: Record<string, string> = {};
const errors: FormikErrors<FormikValues> = {};
if (values.fn && !options?.some((option) => option.data.val)) {
errors.fn =
"At least one option must set a data value when the checklist has a data field";
Expand Down
6 changes: 2 additions & 4 deletions editor.planx.uk/src/@planx/components/Question/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { errors } from "@airbrake/browser/dist/http_req/api";
import FormControlLabel from "@mui/material/FormControlLabel";
import Switch from "@mui/material/Switch";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import { FormikErrors, FormikValues, useFormik } from "formik";
import React, { useEffect, useRef } from "react";
import { ComponentTagSelect } from "ui/editor/ComponentTagSelect";
import ImgInput from "ui/editor/ImgInput/ImgInput";
Expand Down Expand Up @@ -157,12 +156,11 @@ export const Question: React.FC<Props> = (props) => {
}
},
validate: ({ options, ...values }) => {
const errors: Record<string, string> = {};
const errors: FormikErrors<FormikValues> = {};
if (values.fn && !options.some((option) => option.data.val)) {
errors.fn =
"At least one option must set a data value when the question has a data field";
}

return errors;
},
});
Expand Down

0 comments on commit 74ab724

Please sign in to comment.