diff --git a/packages/ra-ui-materialui/src/input/LongTextInput.spec.js b/packages/ra-ui-materialui/src/input/LongTextInput.spec.tsx
similarity index 96%
rename from packages/ra-ui-materialui/src/input/LongTextInput.spec.js
rename to packages/ra-ui-materialui/src/input/LongTextInput.spec.tsx
index 4aa1bdc513f..2155b064e98 100644
--- a/packages/ra-ui-materialui/src/input/LongTextInput.spec.js
+++ b/packages/ra-ui-materialui/src/input/LongTextInput.spec.tsx
@@ -20,7 +20,9 @@ describe('', () => {
render={() => }
/>
);
- const input = getByLabelText('resources.posts.fields.body');
+ const input = getByLabelText(
+ 'resources.posts.fields.body'
+ ) as HTMLInputElement;
expect(input.tagName).toEqual('TEXTAREA');
expect(input.value).toEqual('hello');
});
diff --git a/packages/ra-ui-materialui/src/input/LongTextInput.js b/packages/ra-ui-materialui/src/input/LongTextInput.tsx
similarity index 100%
rename from packages/ra-ui-materialui/src/input/LongTextInput.js
rename to packages/ra-ui-materialui/src/input/LongTextInput.tsx
diff --git a/packages/ra-ui-materialui/src/input/TextInput.spec.js b/packages/ra-ui-materialui/src/input/TextInput.spec.tsx
similarity index 96%
rename from packages/ra-ui-materialui/src/input/TextInput.spec.js
rename to packages/ra-ui-materialui/src/input/TextInput.spec.tsx
index 532dc5c0c64..50636a4dad8 100644
--- a/packages/ra-ui-materialui/src/input/TextInput.spec.js
+++ b/packages/ra-ui-materialui/src/input/TextInput.spec.tsx
@@ -21,7 +21,9 @@ describe('', () => {
render={() => }
/>
);
- const TextFieldElement = getByLabelText('resources.posts.fields.title');
+ const TextFieldElement = getByLabelText(
+ 'resources.posts.fields.title'
+ ) as HTMLInputElement;
expect(TextFieldElement.value).toEqual('hello');
expect(TextFieldElement.getAttribute('type')).toEqual('text');
});
diff --git a/packages/ra-ui-materialui/src/input/TextInput.js b/packages/ra-ui-materialui/src/input/TextInput.tsx
similarity index 87%
rename from packages/ra-ui-materialui/src/input/TextInput.js
rename to packages/ra-ui-materialui/src/input/TextInput.tsx
index ff8f442d5d9..a78d474cb3e 100644
--- a/packages/ra-ui-materialui/src/input/TextInput.js
+++ b/packages/ra-ui-materialui/src/input/TextInput.tsx
@@ -1,6 +1,7 @@
-import React from 'react';
+import React, { FunctionComponent } from 'react';
import PropTypes from 'prop-types';
-import { useInput, FieldTitle } from 'ra-core';
+import { useInput, FieldTitle, InputProps } from 'ra-core';
+import { TextFieldProps } from '@material-ui/core/TextField';
import ResettableTextField from './ResettableTextField';
import InputHelperText from './InputHelperText';
@@ -20,7 +21,9 @@ import sanitizeRestProps from './sanitizeRestProps';
*
* The object passed as `options` props is passed to the component
*/
-export const TextInput = ({
+export const TextInput: FunctionComponent<
+ InputProps & Omit
+> = ({
label,
options,
resource,