From 35bb34b722a81058f7685b8166de0ecb8ca3bb7b Mon Sep 17 00:00:00 2001 From: hasan-deriv Date: Thu, 15 Aug 2024 16:07:53 +0800 Subject: [PATCH] fix: fixed error component typescript issue --- .../src/Components/Errors/error-component.tsx | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/cfd/src/Components/Errors/error-component.tsx b/packages/cfd/src/Components/Errors/error-component.tsx index e7ba28a9a7da..d14474939b90 100644 --- a/packages/cfd/src/Components/Errors/error-component.tsx +++ b/packages/cfd/src/Components/Errors/error-component.tsx @@ -1,9 +1,17 @@ -import PropTypes from 'prop-types'; import React from 'react'; import { Dialog, PageErrorContainer } from '@deriv/components'; import { routes } from '@deriv/shared'; import { localize } from '@deriv/translations'; +type TErrorComponentProps = { + header?: string; + is_dialog?: boolean; + message?: React.ReactNode; + redirect_label?: string; + redirectOnClick?: () => void; + should_show_refresh?: boolean; +}; + const ErrorComponent = ({ header, message, @@ -11,7 +19,7 @@ const ErrorComponent = ({ redirect_label, redirectOnClick, should_show_refresh = true, -}) => { +}: TErrorComponentProps) => { const refresh_message = should_show_refresh ? localize('Please refresh this page to continue.') : ''; if (is_dialog) { @@ -37,14 +45,4 @@ const ErrorComponent = ({ ); }; -ErrorComponent.propTypes = { - header: PropTypes.string, - is_dialog: PropTypes.bool, - message: PropTypes.oneOfType([PropTypes.node, PropTypes.string, PropTypes.object]), - redirect_label: PropTypes.string, - redirectOnClick: PropTypes.func, - should_show_refresh: PropTypes.bool, - type: PropTypes.string, -}; - export default ErrorComponent;