diff --git a/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-footer.spec.js b/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-footer.spec.tsx similarity index 87% rename from packages/account/src/Components/self-exclusion/__tests__/self-exclusion-footer.spec.js rename to packages/account/src/Components/self-exclusion/__tests__/self-exclusion-footer.spec.tsx index a75a0d0e9ea5..b6c55bf88f50 100644 --- a/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-footer.spec.js +++ b/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-footer.spec.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Formik } from 'formik'; +import { Formik, FormikValues } from 'formik'; import * as formik from 'formik'; import { fireEvent, render, screen } from '@testing-library/react'; import SelfExclusionContext from '../self-exclusion-context'; @@ -8,7 +8,7 @@ import SelfExclusionFooter from '../self-exclusion-footer'; const portal_root = document.createElement('div'); document.body.appendChild(portal_root); -const mockUseFormikContext = jest.spyOn(formik, 'useFormikContext'); +const mockUseFormikContext = jest.spyOn(formik, 'useFormikContext') as any; describe('', () => { let mock_context = {}; @@ -26,7 +26,7 @@ describe('', () => { }); }); it('should not render SelfExclusionFooter component', () => { - mock_context.footer_ref = null; + (mock_context as FormikValues).footer_ref = null; render( @@ -39,7 +39,7 @@ describe('', () => { it('should render SelfExclusionFooter component', () => { render( - + @@ -50,10 +50,10 @@ describe('', () => { }); it('Should trigger click on the button', () => { - const mockGoToConfirm = mock_context.goToConfirm; + const mockGoToConfirm = (mock_context as FormikValues).goToConfirm; render( - + diff --git a/packages/account/src/Components/self-exclusion/self-exclusion-context.tsx b/packages/account/src/Components/self-exclusion/self-exclusion-context.tsx index a7fafbda2f61..c0e9a6746e40 100644 --- a/packages/account/src/Components/self-exclusion/self-exclusion-context.tsx +++ b/packages/account/src/Components/self-exclusion/self-exclusion-context.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; type TSelfExclusionContext = { footer_ref?: React.RefObject; - goToConfirm?: () => void; + goToConfirm?: (values: unknown) => void; toggleArticle?: () => void; is_app_settings?: boolean; is_wrapper_bypassed?: boolean; diff --git a/packages/account/src/Components/self-exclusion/self-exclusion-footer.jsx b/packages/account/src/Components/self-exclusion/self-exclusion-footer.tsx similarity index 95% rename from packages/account/src/Components/self-exclusion/self-exclusion-footer.jsx rename to packages/account/src/Components/self-exclusion/self-exclusion-footer.tsx index 9c07c2fc9621..44bc4a4029da 100644 --- a/packages/account/src/Components/self-exclusion/self-exclusion-footer.jsx +++ b/packages/account/src/Components/self-exclusion/self-exclusion-footer.tsx @@ -22,7 +22,7 @@ const SelfExclusionFooter = () => { primary className='da-self-exclusion__button' large - onClick={() => goToConfirm(values)} + onClick={() => goToConfirm?.(values)} type='button' > diff --git a/packages/account/src/Components/self-exclusion/self-exclusion-inputs.jsx b/packages/account/src/Components/self-exclusion/self-exclusion-inputs.jsx index 110df8870525..a0ff2666a7e3 100644 --- a/packages/account/src/Components/self-exclusion/self-exclusion-inputs.jsx +++ b/packages/account/src/Components/self-exclusion/self-exclusion-inputs.jsx @@ -5,7 +5,7 @@ import { getBrandWebsiteName, epochToMoment, toMoment, PlatformContext, isMobile import { Localize, localize } from '@deriv/translations'; import { Field, useFormikContext } from 'formik'; import SelfExclusionContext from './self-exclusion-context'; -import SelfExclusionFooter from './self-exclusion-footer.jsx'; +import SelfExclusionFooter from './self-exclusion-footer'; const SectionTitle = ({ title, has_border_line }) => { return (