Skip to content

Commit

Permalink
[TextField] removed JSX.Element type from FormHelperText component prop
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAndriyanenko committed Apr 14, 2020
1 parent 33a2311 commit 0a9d765
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/material-ui/src/TextField/TextField.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ export interface BaseTextFieldProps
/**
* Props applied to the [`FormHelperText`](/api/form-helper-text/) element.
*/
FormHelperTextProps?: FormHelperTextProps<
React.ElementType,
{ component: React.ElementType | JSX.Element }
>;
FormHelperTextProps?: FormHelperTextProps<React.ElementType, { component: React.ElementType }>;
/**
* If `true`, the input will take up the full width of its container.
*/
Expand Down
7 changes: 6 additions & 1 deletion packages/material-ui/src/TextField/TextField.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ function FocusHandlerTest() {

function createElementTextFieldTest() {
// $ExpectError
const stringParam = <TextField FormHelperTextProps={{ component: 'some-wrong-element' }} />;
const wrongElementType = <TextField FormHelperTextProps={{ component: 'some-wrong-element' }} />;

// $ExpectError
const numberParam = <TextField FormHelperTextProps={{ component: 1234 }} />;

// $ExpectError
const jsxParam = <TextField FormHelperTextProps={{ component: <div /> }} />;

const validElementType = <TextField FormHelperTextProps={{ component: 'div' }} />;
}

0 comments on commit 0a9d765

Please sign in to comment.