diff --git a/packages/app-admin/src/base/ui/FileManager.tsx b/packages/app-admin/src/base/ui/FileManager.tsx index fa27b10d83e..d100577b6dd 100644 --- a/packages/app-admin/src/base/ui/FileManager.tsx +++ b/packages/app-admin/src/base/ui/FileManager.tsx @@ -123,10 +123,7 @@ export const FileManager = ({ children, render, onChange, ...rest }: FileManager // @ts-expect-error setShow(false)} - onChange={ - /* TODO: figure out how to create a conditional type based on the value of `rest.multiple` */ - onChangeRef.current - } + onChange={onChangeRef.current} {...rest} />, containerRef.current diff --git a/packages/app-headless-cms/src/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.tsx b/packages/app-headless-cms/src/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.tsx index 076a7e9a99f..0f08371fb6d 100644 --- a/packages/app-headless-cms/src/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.tsx +++ b/packages/app-headless-cms/src/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.tsx @@ -31,37 +31,40 @@ export type DynamicZoneContainerProps = { className?: string; }; -export const DynamicZoneContainer = makeDecoratable< - React.FunctionComponent ->("DynamicZoneContainer", props => { - const { - field, - bind: { - validation: { isValid, message } - }, - title = field.label, - description = field.helpText, - className, - children - } = props; +export const DynamicZoneContainer = makeDecoratable( + "DynamicZoneContainer", + (props: DynamicZoneContainerProps) => { + const { + field, + bind: { + validation: { isValid, message } + }, + title = field.label, + description = field.helpText, + className, + children + } = props; - const defaultClassName = field.multipleValues ? noBottomPadding : undefined; + const defaultClassName = field.multipleValues ? noBottomPadding : undefined; - return ( - <> - - - {children} - - - {isValid === false && {message}} - - ); -}); + return ( + <> + + + {children} + + + {isValid === false && ( + {message} + )} + + ); + } +); const DynamicZoneContent = ({ field, getBind, contentModel }: CmsModelFieldRendererProps) => { const templates = field.settings?.templates || []; diff --git a/packages/react-composition/src/makeDecoratable.tsx b/packages/react-composition/src/makeDecoratable.tsx index bc81d9003c2..dc3a37ac425 100644 --- a/packages/react-composition/src/makeDecoratable.tsx +++ b/packages/react-composition/src/makeDecoratable.tsx @@ -1,12 +1,6 @@ import React, { createContext, useContext, useMemo } from "react"; import { useComponent } from "./Context"; -import { - CanReturnNull, - DecoratableComponent, - DecoratableHook, - GenericComponent, - GenericHook -} from "~/types"; +import { DecoratableComponent, DecoratableHook, GenericComponent, GenericHook } from "~/types"; import { withDecoratorFactory, withHookDecoratorFactory } from "~/decorators"; const ComposableContext = createContext([]); @@ -75,11 +69,13 @@ export function createVoidComponent() { }; } -export function makeDecoratable(hook: T): DecoratableHook; +export function makeDecoratable( + hook: T +): ReturnType>; export function makeDecoratable( name: string, Component: T -): DecoratableComponent>; +): ReturnType>; export function makeDecoratable(hookOrName: any, Component?: any) { if (Component) { return makeDecoratableComponent(hookOrName, Component);