Use Typescript instead of InferProps
[MAILPOET-2658]
This commit is contained in:
committed by
Jack Kitterhing
parent
34409432e8
commit
e951591d6f
@@ -1,18 +1,13 @@
|
|||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import PropTypes, { InferProps } from 'prop-types';
|
|
||||||
import Notice from 'notices/notice';
|
import Notice from 'notices/notice';
|
||||||
|
|
||||||
const propTypes = {
|
type Props = {
|
||||||
errors: PropTypes.arrayOf(PropTypes.shape({
|
errors: Array<{ message: string }>
|
||||||
message: PropTypes.string.isRequired,
|
}
|
||||||
})).isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
const APIErrorsNotice: FC<InferProps<typeof propTypes>> = ({ errors }) => {
|
const APIErrorsNotice: FC<Props> = ({ errors }) => {
|
||||||
if (errors.length < 1) return null;
|
if (errors.length < 1) return null;
|
||||||
return <Notice type="error" closable={false}>{errors.map((err) => <p key={err.message}>{err.message}</p>)}</Notice>;
|
return <Notice type="error" closable={false}>{errors.map((err) => <p key={err.message}>{err.message}</p>)}</Notice>;
|
||||||
};
|
};
|
||||||
|
|
||||||
APIErrorsNotice.propTypes = propTypes;
|
|
||||||
|
|
||||||
export default APIErrorsNotice;
|
export default APIErrorsNotice;
|
||||||
|
Reference in New Issue
Block a user