diff --git a/src/components/BodyPortal.spec.tsx b/src/components/BodyPortal.spec.tsx index 860cf85d0..92f42c441 100644 --- a/src/components/BodyPortal.spec.tsx +++ b/src/components/BodyPortal.spec.tsx @@ -181,7 +181,7 @@ describe('BodyPortal', () => { }); it('accepts an optional ref parameter that will be set', () => { - const TestPortal = ({ children }: React.PropsWithChildren<{}>) => { + const TestPortal = ({ children }: React.PropsWithChildren) => { const ref = React.useRef(null); expect(ref.current).toBeNull(); diff --git a/src/components/BodyPortal.tsx b/src/components/BodyPortal.tsx index b3a42cb90..fea810d4c 100644 --- a/src/components/BodyPortal.tsx +++ b/src/components/BodyPortal.tsx @@ -21,12 +21,16 @@ const getInsertBeforeTarget = (bodyPortalSlots: string[], slot?: string) => { return null; } -export const BodyPortal = React.forwardRef>(({ children, className, role, slot, tagName }, ref) => { +}>; + +export const BodyPortal = React.forwardRef(( + { children, className, role, slot, tagName }, ref?: React.ForwardedRef +) => { const tag = tagName?.toUpperCase() ?? 'DIV'; const internalRef = React.useRef(document.createElement(tag)); if (internalRef.current.tagName !== tag) {