From 18753cf1142d70f7100bc6fd5aa913813491042e Mon Sep 17 00:00:00 2001 From: Chris Villa Date: Thu, 21 Sep 2023 15:13:22 +0100 Subject: [PATCH] fix: add missing id type to render props --- packages/core/components/Render/index.tsx | 2 +- packages/core/types/Config.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/core/components/Render/index.tsx b/packages/core/components/Render/index.tsx index 7010f1ced..966bffe89 100644 --- a/packages/core/components/Render/index.tsx +++ b/packages/core/components/Render/index.tsx @@ -8,7 +8,7 @@ export function Render({ config, data }: { config: Config; data: Data }) { if (config.root) { return ( - + diff --git a/packages/core/types/Config.tsx b/packages/core/types/Config.tsx index 0db7feede..305b18cc7 100644 --- a/packages/core/types/Config.tsx +++ b/packages/core/types/Config.tsx @@ -8,6 +8,10 @@ export type Adaptor = { ) => Promise[] | null>; }; +type WithId = T & { + id: string; +}; + export type Field< Props extends { [key: string]: any } = { [key: string]: any } > = { @@ -67,7 +71,7 @@ export type ComponentConfig< ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps > = { - render: (props: ComponentProps) => ReactElement; + render: (props: WithId) => ReactElement; defaultProps?: DefaultProps; fields?: Fields; }; @@ -91,9 +95,9 @@ export type Config< type MappedItem = { type: keyof Props; - props: { + props: WithId<{ [key: string]: any; - } & { id: string }; + }>; }; export type Data<