Use React.FunctionComponent when typing

This commit is contained in:
Tom Russell 2019-08-14 08:28:15 +01:00
parent 2127521094
commit a5447e6ee3
2 changed files with 6 additions and 6 deletions

View File

@ -70,7 +70,7 @@ class EditForm extends Component<any, any> { // TODO: add proper types
for (const field of props.fields) { for (const field of props.fields) {
fieldsObj[field.slug] = props[field.slug]; fieldsObj[field.slug] = props[field.slug];
} }
this.state = { this.state = {
error: this.props.error || undefined, error: this.props.error || undefined,
like: this.props.like || undefined, like: this.props.like || undefined,
@ -591,7 +591,7 @@ class YearEstimator extends Component<any, any> { // TODO: add proper types
toggleCopyAttribute: PropTypes.func, toggleCopyAttribute: PropTypes.func,
copying: PropTypes.bool copying: PropTypes.bool
}; };
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -680,7 +680,7 @@ LikeButton.propTypes = {
handleLike: PropTypes.func handleLike: PropTypes.func
} }
const Label: React.SFC<any> = (props) => { // TODO: remove any const Label: React.FunctionComponent<any> = (props) => { // TODO: remove any
return ( return (
<label htmlFor={props.slug}> <label htmlFor={props.slug}>
{props.title} {props.title}

View File

@ -205,7 +205,7 @@ class DataSection extends React.Component<any, any> { // TODO: add proper types
} }
} }
const DataEntry: React.SFC<any> = (props) => { // TODO: remove any const DataEntry: React.FunctionComponent<any> = (props) => { // TODO: remove any
return ( return (
<Fragment> <Fragment>
<dt> <dt>
@ -241,7 +241,7 @@ DataEntry.propTypes = {
value: PropTypes.any value: PropTypes.any
} }
const LikeDataEntry: React.SFC<any> = (props) => { // TODO: remove any const LikeDataEntry: React.FunctionComponent<any> = (props) => { // TODO: remove any
const data_string = JSON.stringify({like: true}); const data_string = JSON.stringify({like: true});
return ( return (
<Fragment> <Fragment>
@ -280,7 +280,7 @@ LikeDataEntry.propTypes = {
user_building_like: PropTypes.bool user_building_like: PropTypes.bool
} }
const MultiDataEntry: React.SFC<any> = (props) => { // TODO: remove any const MultiDataEntry: React.FunctionComponent<any> = (props) => { // TODO: remove any
let content; let content;
if (props.value && props.value.length) { if (props.value && props.value.length) {