diff --git a/packages/mui-material/src/TextField/TextField.d.ts b/packages/mui-material/src/TextField/TextField.d.ts index 1a70c8215645c2..0af84b5b8a131e 100644 --- a/packages/mui-material/src/TextField/TextField.d.ts +++ b/packages/mui-material/src/TextField/TextField.d.ts @@ -66,7 +66,9 @@ export interface BaseTextFieldProps /** * Props applied to the [`FormHelperText`](/api/form-helper-text/) element. */ - FormHelperTextProps?: Partial; + FormHelperTextProps?: Partial< + FormHelperTextProps + >; /** * If `true`, the input will take up the full width of its container. * @default false diff --git a/packages/mui-material/src/TextField/TextField.spec.tsx b/packages/mui-material/src/TextField/TextField.spec.tsx index 56846edd6b25c5..bf12cef4ab9358 100644 --- a/packages/mui-material/src/TextField/TextField.spec.tsx +++ b/packages/mui-material/src/TextField/TextField.spec.tsx @@ -69,3 +69,20 @@ function FocusHandlerTest() { return null; } + +function FormHelperTextPropsTest() { + const validTagName = ; + + const validReactComponent = ( +
${children}
}} /> + ); + + // @ts-expect-error + const invalidTagName = ; + + // @ts-expect-error + const invalidJSXTag = }} />; + + // @ts-expect-error + const invalidNumericParam = ; +} diff --git a/packages/mui-material/src/TextField/TextField.test.js b/packages/mui-material/src/TextField/TextField.test.js index 2b9e16ac9f749a..cdee696f7feac2 100644 --- a/packages/mui-material/src/TextField/TextField.test.js +++ b/packages/mui-material/src/TextField/TextField.test.js @@ -85,6 +85,18 @@ describe('', () => { expect(getDescriptionOf(getByRole('textbox'))).to.have.class('foo'); }); + it('should honor FormHelperTextProps component', () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId('helper-text')).to.have.tagName('div'); + }); + it('has an accessible description', () => { const { getByRole } = render(