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 PropTypes, { InferProps } from 'prop-types';
|
||||
import Notice from 'notices/notice';
|
||||
|
||||
const propTypes = {
|
||||
errors: PropTypes.arrayOf(PropTypes.shape({
|
||||
message: PropTypes.string.isRequired,
|
||||
})).isRequired,
|
||||
};
|
||||
type Props = {
|
||||
errors: Array<{ message: string }>
|
||||
}
|
||||
|
||||
const APIErrorsNotice: FC<InferProps<typeof propTypes>> = ({ errors }) => {
|
||||
const APIErrorsNotice: FC<Props> = ({ errors }) => {
|
||||
if (errors.length < 1) return null;
|
||||
return <Notice type="error" closable={false}>{errors.map((err) => <p key={err.message}>{err.message}</p>)}</Notice>;
|
||||
};
|
||||
|
||||
APIErrorsNotice.propTypes = propTypes;
|
||||
|
||||
export default APIErrorsNotice;
|
||||
|
Reference in New Issue
Block a user