replace JSX.Element with React.ReactElement

See: @Ferdaber's note at: https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/docs/advanced/types-react-ap.md

> I discourage the use of most `...Element` types because of how black-boxy `JSX.Element` is. You should almost always assume that anything produced by `React.createElement` is the base type `React.ReactElement`.
This commit is contained in:
fernandomg 2020-07-15 18:48:29 -03:00
parent b9262ffdf0
commit 1671136115
6 changed files with 6 additions and 6 deletions

View File

@ -42,7 +42,7 @@ interface Props {
ethBalance?: string ethBalance?: string
} }
const AddressInfo = ({ ethBalance, safeAddress, safeName }: Props): JSX.Element => { const AddressInfo = ({ ethBalance, safeAddress, safeName }: Props): React.ReactElement => {
return ( return (
<Wrapper> <Wrapper>
<div className="icon-section"> <div className="icon-section">

View File

@ -45,7 +45,7 @@ const typePlaceholder = (text: string, type: string): string => {
return `${text} E.g.: ["first value", "second value", "third value"]` return `${text} E.g.: ["first value", "second value", "third value"]`
} }
const ArrayTypeInput = ({ name, text, type }: { name: string; text: string; type: string }): JSX.Element => ( const ArrayTypeInput = ({ name, text, type }: { name: string; text: string; type: string }): React.ReactElement => (
<TextareaField name={name} placeholder={typePlaceholder(text, type)} text={text} type="text" validate={validator} /> <TextareaField name={name} placeholder={typePlaceholder(text, type)} text={text} type="text" validate={validator} />
) )

View File

@ -15,7 +15,7 @@ type Props = {
placeholder: string placeholder: string
} }
const InputComponent = ({ type, keyValue, placeholder }: Props): JSX.Element => { const InputComponent = ({ type, keyValue, placeholder }: Props): React.ReactElement => {
if (!type) { if (!type) {
return null return null
} }

View File

@ -7,7 +7,7 @@ import InputComponent from './InputComponent'
import { generateFormFieldKey } from '../utils' import { generateFormFieldKey } from '../utils'
import { AbiItemExtended } from 'src/logic/contractInteraction/sources/ABIService' import { AbiItemExtended } from 'src/logic/contractInteraction/sources/ABIService'
const RenderInputParams = (): JSX.Element => { const RenderInputParams = (): React.ReactElement => {
const { const {
meta: { valid: validABI }, meta: { valid: validABI },
} = useField('abi', { subscription: { valid: true, value: true } }) } = useField('abi', { subscription: { valid: true, value: true } })

View File

@ -72,7 +72,7 @@ const openIconStyle = {
color: secondary, color: secondary,
} }
const Advanced = (): JSX.Element => { const Advanced = (): React.ReactElement => {
const classes = useStyles() const classes = useStyles()
const columns = generateColumns() const columns = generateColumns()

View File

@ -17,7 +17,7 @@ const INITIAL_STATE = {
showReceive: false, showReceive: false,
} }
const SafeView = (): JSX.Element => { const SafeView = (): React.ReactElement => {
const [state, setState] = useState(INITIAL_STATE) const [state, setState] = useState(INITIAL_STATE)
const safeAddress = useSelector(safeParamAddressFromStateSelector) const safeAddress = useSelector(safeParamAddressFromStateSelector)