diff --git a/packages-internal/test-utils/src/describeConformance.tsx b/packages-internal/test-utils/src/describeConformance.tsx index 2270bac2bd461e..2cd9d11010c56b 100644 --- a/packages-internal/test-utils/src/describeConformance.tsx +++ b/packages-internal/test-utils/src/describeConformance.tsx @@ -45,7 +45,7 @@ export interface ConformanceOptions { refInstanceof: any; after?: () => void; inheritComponent?: React.ElementType; - render: (node: React.ReactElement) => MuiRenderResult | Promise; + render: (node: React.ReactElement) => MuiRenderResult | Promise; only?: Array; skip?: Array; testComponentsRootPropWith?: string; @@ -495,7 +495,13 @@ function testSlotsProp( }); } -function testSlotPropsProp(element: React.ReactElement, getOptions: () => ConformanceOptions) { +function testSlotPropsProp( + element: React.ReactElement<{ + componentsProps?: Record; + slotProps: Record; + }>, + getOptions: () => ConformanceOptions, +) { const { render, slots, testLegacyComponentsProp } = getOptions(); if (!render) { @@ -579,7 +585,10 @@ function testSlotPropsProp(element: React.ReactElement, getOptions: () => C } function testSlotPropsCallback( - element: React.ReactElement, + element: React.ReactElement<{ + slotProps: Record DataProps>; + className: string; + }>, getOptions: () => ConformanceOptions, ) { const { render, slots } = getOptions(); @@ -606,7 +615,10 @@ function testSlotPropsCallback( } function testSlotPropsCallbackWithPropsAsOwnerState( - element: React.ReactElement, + element: React.ReactElement<{ + slotProps: Record) => DataProps>; + className: string; + }>, getOptions: () => ConformanceOptions, ) { const { render, slots } = getOptions(); @@ -637,7 +649,11 @@ function testSlotPropsCallbackWithPropsAsOwnerState( * Components from @inheritComponent */ function testComponentsProp( - element: React.ReactElement, + element: React.ReactElement< + { + components?: Record; + } & DataProps + >, getOptions: () => ConformanceOptions, ) { describe('prop components:', () => { @@ -663,7 +679,7 @@ function testComponentsProp( * Components from @inheritComponent */ function testThemeDefaultProps( - element: React.ReactElement, + element: React.ReactElement, getOptions: () => ConformanceOptions, ) { describe('theme default components:', () => { @@ -747,7 +763,7 @@ function testThemeDefaultProps( * Components from @inheritComponent */ function testThemeStyleOverrides( - element: React.ReactElement, + element: React.ReactElement, getOptions: () => ConformanceOptions, ) { describe('theme style overrides:', () => { @@ -999,7 +1015,10 @@ function testThemeStyleOverrides( * MUI theme has a components section that allows specifying custom variants. * Components from @inheritComponent */ -function testThemeVariants(element: React.ReactElement, getOptions: () => ConformanceOptions) { +function testThemeVariants( + element: React.ReactElement, + getOptions: () => ConformanceOptions, +) { describe('theme variants:', () => { it("respect theme's variants", async function test(t = {}) { if (/jsdom/.test(window.navigator.userAgent)) { @@ -1109,7 +1128,7 @@ function testThemeVariants(element: React.ReactElement, getOptions: () => C * The components that iterate over the palette via `variants` should be able to render with or without applying the custom palette styles. */ function testThemeCustomPalette( - element: React.ReactElement, + element: React.ReactElement, getOptions: () => ConformanceOptions, ) { describe('theme extended palette:', () => {