@@ -91,7 +91,7 @@ function throwMissingPropError(field: string): never {
9191 * the root component.
9292 */
9393export function testClassName (
94- element : React . ReactElement < unknown > ,
94+ element : React . ReactElement < HTMLElement & { 'data-testid' : string } > ,
9595 getOptions : ( ) => ConformanceOptions ,
9696) {
9797 it ( 'applies the className to the root component' , async ( ) => {
@@ -117,7 +117,12 @@ export function testClassName(
117117 * Component from @inheritComponent
118118 */
119119export function testComponentProp (
120- element : React . ReactElement < unknown > ,
120+ element : React . ReactElement <
121+ HTMLElement & {
122+ component ?: string | ( ( props : { } ) => React . ReactElement ) ;
123+ 'data-testid' : string ;
124+ }
125+ > ,
121126 getOptions : ( ) => ConformanceOptions ,
122127) {
123128 describe ( 'prop: component' , ( ) => {
@@ -153,7 +158,7 @@ export function testComponentProp(
153158 * MUI components spread additional props to its root.
154159 */
155160export function testPropsSpread (
156- element : React . ReactElement < unknown > ,
161+ element : React . ReactElement < HTMLElement & { [ key : `data-${ string } ` ] : string } > ,
157162 getOptions : ( ) => ConformanceOptions ,
158163) {
159164 it ( `spreads props to the root component` , async ( ) => {
@@ -183,7 +188,7 @@ export function testPropsSpread(
183188 * components that forward their ref and attach it to a host component.
184189 */
185190export function describeRef (
186- element : React . ReactElement < unknown > ,
191+ element : React . ReactElement < HTMLElement & { ref ?: React . Ref < any > } > ,
187192 getOptions : ( ) => ConformanceOptions ,
188193) {
189194 describe ( 'ref' , ( ) => {
@@ -208,7 +213,7 @@ export function describeRef(
208213 * Tests that the root component has the root class
209214 */
210215export function testRootClass (
211- element : React . ReactElement < unknown > ,
216+ element : React . ReactElement < HTMLElement & { classes : Record < string , string > } > ,
212217 getOptions : ( ) => ConformanceOptions ,
213218) {
214219 it ( 'applies the root class to the root component if it has this class' , async ( ) => {
@@ -260,7 +265,17 @@ function forEachSlot(
260265 } ) ;
261266}
262267
263- function testSlotsProp ( element : React . ReactElement < unknown > , getOptions : ( ) => ConformanceOptions ) {
268+ function testSlotsProp (
269+ element : React . ReactElement <
270+ HTMLElement & {
271+ slots : Record < string , any > ;
272+ slotProps : Record < string , any > ;
273+ components : Record < string , any > ;
274+ componentsProps : Record < string , any > ;
275+ }
276+ > ,
277+ getOptions : ( ) => ConformanceOptions ,
278+ ) {
264279 const { render, slots, testLegacyComponentsProp } = getOptions ( ) ;
265280
266281 const CustomComponent = React . forwardRef <
@@ -432,7 +447,9 @@ function testSlotsProp(element: React.ReactElement<unknown>, getOptions: () => C
432447}
433448
434449function testSlotPropsProp (
435- element : React . ReactElement < unknown > ,
450+ element : React . ReactElement <
451+ HTMLElement & { slotProps : Record < string , any > ; componentsProps : Record < string , any > }
452+ > ,
436453 getOptions : ( ) => ConformanceOptions ,
437454) {
438455 const { render, slots, testLegacyComponentsProp } = getOptions ( ) ;
@@ -518,7 +535,7 @@ function testSlotPropsProp(
518535}
519536
520537function testSlotPropsCallback (
521- element : React . ReactElement < unknown > ,
538+ element : React . ReactElement < HTMLElement & { slotProps : Record < string , any > } > ,
522539 getOptions : ( ) => ConformanceOptions ,
523540) {
524541 const { render, slots } = getOptions ( ) ;
@@ -549,7 +566,9 @@ function testSlotPropsCallback(
549566 * Components from @inheritComponent
550567 */
551568function testComponentsProp (
552- element : React . ReactElement < unknown > ,
569+ element : React . ReactElement <
570+ HTMLElement & { components : Record < string , any > ; 'data-testid' : string }
571+ > ,
553572 getOptions : ( ) => ConformanceOptions ,
554573) {
555574 describe ( 'prop components:' , ( ) => {
@@ -868,7 +887,7 @@ function testThemeStyleOverrides(
868887 * Components from @inheritComponent
869888 */
870889function testThemeVariants (
871- element : React . ReactElement < unknown > ,
890+ element : React . ReactElement < HTMLElement & { 'data-testid' : string ; variant : string } > ,
872891 getOptions : ( ) => ConformanceOptions ,
873892) {
874893 describe ( 'theme variants:' , ( ) => {
@@ -976,7 +995,7 @@ function testThemeVariants(
976995 * The components that iterate over the palette via `variants` should be able to render with or without applying the custom palette styles.
977996 */
978997function testThemeCustomPalette (
979- element : React . ReactElement < unknown > ,
998+ element : React . ReactElement < HTMLElement > ,
980999 getOptions : ( ) => ConformanceOptions ,
9811000) {
9821001 describe ( 'theme extended palette:' , ( ) => {
@@ -1021,7 +1040,7 @@ const fullSuite = {
10211040 * components.
10221041 */
10231042function describeConformance (
1024- minimalElement : React . ReactElement < unknown > ,
1043+ minimalElement : React . ReactElement < HTMLElement > ,
10251044 getOptions : ( ) => ConformanceOptions ,
10261045) {
10271046 let originalMatchmedia : typeof window . matchMedia ;
0 commit comments