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<