From ea3481752e86e3ec99610df87a34d189367d7118 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Fri, 29 Nov 2024 15:06:35 +0100 Subject: [PATCH] better types --- editor.planx.uk/src/@planx/components/List/utils.tsx | 2 +- .../shared/Schema/InputFields/AddressFieldInput.tsx | 7 ++----- .../src/@planx/components/shared/Schema/model.ts | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/List/utils.tsx b/editor.planx.uk/src/@planx/components/List/utils.tsx index af69b1c3cc..41c6cf7050 100644 --- a/editor.planx.uk/src/@planx/components/List/utils.tsx +++ b/editor.planx.uk/src/@planx/components/List/utils.tsx @@ -16,7 +16,7 @@ const List = styled("ul")(() => ({ * @returns string | React.JSX.Element - the `text` for the given value `val`, or the original value */ export function formatSchemaDisplayValue( - value: string | string[] | Record, + value: string | string[], field: Field, ) { switch (field.type) { diff --git a/editor.planx.uk/src/@planx/components/shared/Schema/InputFields/AddressFieldInput.tsx b/editor.planx.uk/src/@planx/components/shared/Schema/InputFields/AddressFieldInput.tsx index d1a9db61a2..2ce28ab765 100644 --- a/editor.planx.uk/src/@planx/components/shared/Schema/InputFields/AddressFieldInput.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Schema/InputFields/AddressFieldInput.tsx @@ -1,9 +1,6 @@ import Box from "@mui/material/Box"; import Typography from "@mui/material/Typography"; -import { - AddressFields, - FormProps, -} from "@planx/components/AddressInput/Public"; +import { AddressFields } from "@planx/components/AddressInput/Public"; import React from "react"; import InputLegend from "ui/editor/InputLegend"; @@ -27,7 +24,7 @@ export const AddressFieldInput: React.FC> = (props) => { )} diff --git a/editor.planx.uk/src/@planx/components/shared/Schema/model.ts b/editor.planx.uk/src/@planx/components/shared/Schema/model.ts index 26c2e8aa68..bc20828916 100644 --- a/editor.planx.uk/src/@planx/components/shared/Schema/model.ts +++ b/editor.planx.uk/src/@planx/components/shared/Schema/model.ts @@ -130,8 +130,8 @@ export interface Schema { export type SchemaUserResponse = Record< Field["data"]["fn"], - string | string[] | Record | any[] ->; // string | string[] | Record | Feature[] + string | string[] | any +>; // string | string[] | Record (address field) | Feature[] (map field) /** * Output data from a form using the useSchema hook