From e5aa168d4c7f6eb27097a67900290369a4eee170 Mon Sep 17 00:00:00 2001 From: tay suisin Date: Thu, 5 Jan 2023 18:13:10 +0800 Subject: [PATCH 1/9] refactor: ts migration for poi form on signup and idv submit on sign up --- .../currency-selector/currency-selector.tsx | 37 +++--- .../currency-selector/radio-button-group.tsx | 2 +- ...ignup.jsx => idv-doc-submit-on-signup.tsx} | 123 +++++++++++------- .../idv-doc-submit-on-signup/index.js | 2 +- ...m-on-signup.jsx => poi-form-on-signup.tsx} | 22 +++- .../proof-of-identity-submission-for-mt5.jsx | 2 +- packages/cfd/globals.d.ts | 4 + packages/cfd/tsconfig.json | 1 + .../auto-height-wrapper.tsx | 16 +-- .../components/auto-height-wrapper/index.ts | 3 +- .../themed-scrollbars/themed-scrollbars.tsx | 2 +- packages/components/src/index.js | 2 +- 12 files changed, 133 insertions(+), 83 deletions(-) rename packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/{idv-doc-submit-on-signup.jsx => idv-doc-submit-on-signup.tsx} (87%) rename packages/account/src/Components/poi/poi-form-on-signup/{poi-form-on-signup.jsx => poi-form-on-signup.tsx} (60%) diff --git a/packages/account/src/Components/currency-selector/currency-selector.tsx b/packages/account/src/Components/currency-selector/currency-selector.tsx index 9a7f579d9521..17a3b398b4cd 100644 --- a/packages/account/src/Components/currency-selector/currency-selector.tsx +++ b/packages/account/src/Components/currency-selector/currency-selector.tsx @@ -14,7 +14,7 @@ export const Hr = () =>
; type TCurrencySelectorExtend = { accounts: { [key: string]: TAuthAccountInfo }; available_crypto_currencies: TCurrencyConfig[]; - getCurrentStep?: () => number; + getCurrentStep: () => number; goToNextStep: () => void; goToPreviousStep: () => void; has_cancel: boolean; @@ -181,7 +181,7 @@ const CurrencySelector = ({ > {({ handleSubmit, values }: FormikState & FormikHandlers) => ( - {({ setRef, height }: { setRef: string; height: number }) => ( + {({ setRef, height }: { setRef: (instance: HTMLFormElement | null) => void; height: number }) => (
- {reorderCurrencies(fiat).map((currency: TCurrencyConfig) => ( + {reorderCurrencies(fiat).map((currency: FormikValues) => ( - {reorderCurrencies(crypto, 'crypto').map( - (currency: TCurrencyConfig) => ( - - value === currency.value - )?.length === 0 - } - name='currency' - id={currency.value} - label={currency.name} - /> - ) - )} + {reorderCurrencies(crypto, 'crypto').map((currency: FormikValues) => ( + value === currency.value + )?.length === 0 + } + name='currency' + id={currency.value} + label={currency.name} + /> + ))} )} diff --git a/packages/account/src/Components/currency-selector/radio-button-group.tsx b/packages/account/src/Components/currency-selector/radio-button-group.tsx index 0c028cbfe850..31ae2ab10ead 100644 --- a/packages/account/src/Components/currency-selector/radio-button-group.tsx +++ b/packages/account/src/Components/currency-selector/radio-button-group.tsx @@ -5,7 +5,7 @@ import { Text } from '@deriv/components'; export type TRadioButtonGroup = { className: string; - is_fiat: boolean; + is_fiat?: boolean; is_title_enabled?: boolean; item_count: number; label: string; diff --git a/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.jsx b/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.tsx similarity index 87% rename from packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.jsx rename to packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.tsx index aa2364cae019..acd248f54380 100644 --- a/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.jsx +++ b/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.tsx @@ -1,6 +1,5 @@ +import { Formik, Field, FormikErrors, FormikValues, FormikHelpers, FormikProps } from 'formik'; import React from 'react'; -import { useLocation } from 'react-router'; -import { Formik, Field } from 'formik'; import { localize, Localize } from '@deriv/translations'; import { Autocomplete, @@ -15,19 +14,35 @@ import { ThemedScrollbars, } from '@deriv/components'; import { isDesktop, formatInput, isMobile } from '@deriv/shared'; -import { getDocumentData, getRegex, isSequentialNumber, isRecurringNumberRegex } from '../../idv-document-submit/utils'; -import { useToggleValidation } from '../../../hooks/useToggleValidation'; +import { getDocumentData, getRegex } from '../../idv-document-submit/utils'; import DocumentSubmitLogo from 'Assets/ic-document-submit-icon.svg'; -export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, onNext, value, has_idv_error }) => { - const location = useLocation(); - const validation_is_enabled = useToggleValidation(location?.hash); - const [document_list, setDocumentList] = React.useState([]); - const [document_image, setDocumentImage] = React.useState(null); +type TIdvDocSubmitOnSignup = { + citizen_data: FormikValues; + has_previous: boolean; + onPrevious: (values: FormikValues) => void; + onNext: ( + values: FormikValues, + action: FormikHelpers<{ document_type: FormikValues; document_number: FormikValues }> + ) => void; + value: FormikValues; + has_idv_error?: boolean; +}; + +export const IdvDocSubmitOnSignup = ({ + citizen_data, + has_previous, + onPrevious, + onNext, + value, + has_idv_error, +}: TIdvDocSubmitOnSignup) => { + const [document_list, setDocumentList] = React.useState([]); + const [document_image, setDocumentImage] = React.useState(null); const [is_input_disable, setInputDisable] = React.useState(true); const [is_doc_selected, setDocSelected] = React.useState(false); - const document_data = citizen_data.identity.services.idv.documents_supported; + const document_data = citizen_data?.identity.services.idv.documents_supported; const { value: country_code, identity: { @@ -73,16 +88,9 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o document_number: value ? value.document_number : '', }; - const validateFields = values => { - const errors = {}; + const validateFields = (values: FormikValues) => { + const errors: FormikErrors = {}; const { document_type, document_number } = values; - const is_sequential_number = isSequentialNumber(document_number); - const is_recurring_number = isRecurringNumberRegex(document_number); - - // QA can manually toggle this regex now through this feature flag. - // Otherwise it blocks their test suite. - const is_allowing_validation = validation_is_enabled; - if (!document_type || !document_type.text || !document_type.value) { errors.document_type = localize('Please select a document type.'); } else { @@ -92,8 +100,6 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o if (!document_number) { errors.document_number = localize('Please enter your document number. ') + getExampleFormat(document_type.example_format); - } else if (is_allowing_validation && (is_recurring_number || is_sequential_number)) { - errors.document_number = localize('Please enter a valid ID number.'); } else { const format_regex = getRegex(document_type.value); if (!format_regex.test(document_number)) { @@ -105,7 +111,7 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o return errors; }; - const resetDocumentItemSelected = setFieldValue => { + const resetDocumentItemSelected = (setFieldValue: FormikHelpers['setFieldValue']) => { setFieldValue( 'document_type', { @@ -120,11 +126,11 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o setDocumentImage(''); }; - const getDocument = text => { - return document_list.find(d => d.text === text); + const getDocument = (text: string) => { + return document_list.find((d: FormikValues) => d.text === text); }; - const getExampleFormat = example_format => { + const getExampleFormat = (example_format: string) => { return example_format ? localize('Example: ') + example_format : ''; }; @@ -139,11 +145,30 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o validateOnChange validateOnBlur > - {({ errors, handleBlur, handleChange, handleSubmit, isValid, setFieldValue, touched, values }) => ( + {({ + errors, + handleBlur, + handleChange, + handleSubmit, + isValid, + setFieldValue, + touched, + values, + }: Pick< + FormikProps, + | 'errors' + | 'handleBlur' + | 'handleChange' + | 'handleSubmit' + | 'isValid' + | 'setFieldValue' + | 'touched' + | 'values' + >) => ( - {({ setRef }) => ( + {({ setRef }: { setRef: (instance: HTMLFormElement | null) => void }) => ( - +
@@ -184,7 +209,7 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o
- {({ field }) => ( + {({ field }: FormikValues) => (
@@ -203,7 +228,9 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o )} list_items={document_list} value={values.document_type.text} - onBlur={e => { + onBlur={( + e: React.ChangeEvent + ) => { handleBlur(e); if (!getDocument(e.target.value)) { resetDocumentItemSelected( @@ -212,7 +239,9 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o } }} onChange={handleChange} - onItemSelection={item => { + onItemSelection={( + item: FormikValues + ) => { if ( item.text === 'No results found' || @@ -251,9 +280,13 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o label={localize('Choose the document type')} list_items={document_list} value={values.document_type.text} - onChange={e => { + onChange={( + e: React.ChangeEvent + ) => { handleChange(e); - const selected_document = getDocument( + const selected_document: + | undefined + | FormikValues = getDocument( e.target.value ); if (selected_document) { @@ -281,7 +314,7 @@ export const IdvDocSubmitOnSignup = ({ citizen_data, has_previous, onPrevious, o
- {({ field }) => ( + {({ field }: FormikValues) => ( e.preventDefault()} onBlur={handleBlur} onChange={handleChange} - onKeyUp={e => { + onKeyUp={( + e: React.KeyboardEvent + ) => { const { example_format } = values.document_type; - const current_input = example_format?.includes( - '-' - ) - ? formatInput( - example_format, - current_input || e.target.value, - '-' - ) - : e.target.value; + const current_input: string = + example_format.includes('-') + ? formatInput( + example_format, + e.currentTarget.value, + '-' + ) + : e.currentTarget.value; setFieldValue( 'document_number', current_input, diff --git a/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/index.js b/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/index.js index 2341d2a1ad6a..b00615be2bba 100644 --- a/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/index.js +++ b/packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/index.js @@ -1,3 +1,3 @@ -import { IdvDocSubmitOnSignup } from './idv-doc-submit-on-signup.jsx'; +import { IdvDocSubmitOnSignup } from './idv-doc-submit-on-signup'; export default IdvDocSubmitOnSignup; diff --git a/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.jsx b/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx similarity index 60% rename from packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.jsx rename to packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx index f07f66bcffdd..c1c9bc4fd79c 100644 --- a/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.jsx +++ b/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx @@ -1,6 +1,19 @@ import React from 'react'; import PropTypes from 'prop-types'; import IdvDocSubmitOnSignup from './idv-doc-submit-on-signup'; +import { FormikValues } from 'formik'; + +type TProofOfIdentityFormOnSignup = { + getCurrentStep: () => number; + goToPreviousStep: () => void; + goToNextStep: () => void; + onCancel: (step: number, prev_step: () => void) => void; + onSave: (step: number, values: object) => void; + onSubmit: (step: number, values: object, action: FormikValues, next_step: () => void) => void; + value: object; + residence_list: object[]; + citizen: string; +}; export const ProofOfIdentityFormOnSignup = ({ getCurrentStep, @@ -12,14 +25,15 @@ export const ProofOfIdentityFormOnSignup = ({ value, residence_list, citizen, -}) => { - const citizen_data = residence_list.find(residence => residence.value === citizen); +}: TProofOfIdentityFormOnSignup) => { + const citizen_data: FormikValues = + residence_list.find((residence: FormikValues) => residence.value === citizen) || {}; - const handleSubmit = (values, actions) => { + const handleSubmit = (values: FormikValues, actions: FormikValues) => { onSubmit(getCurrentStep() - 1, values, actions.setSubmitting, goToNextStep); }; - const handleCancel = values => { + const handleCancel = (values: FormikValues) => { const current_step = getCurrentStep() - 1; onSave(current_step, values); onCancel(current_step, goToPreviousStep); diff --git a/packages/account/src/Sections/Verification/ProofOfIdentity/proof-of-identity-submission-for-mt5.jsx b/packages/account/src/Sections/Verification/ProofOfIdentity/proof-of-identity-submission-for-mt5.jsx index 1fcbd1dc56f9..3cf0ba7bd81e 100644 --- a/packages/account/src/Sections/Verification/ProofOfIdentity/proof-of-identity-submission-for-mt5.jsx +++ b/packages/account/src/Sections/Verification/ProofOfIdentity/proof-of-identity-submission-for-mt5.jsx @@ -4,7 +4,7 @@ import { WS } from '@deriv/shared'; import Unsupported from 'Components/poi/status/unsupported'; import OnfidoUpload from './onfido-sdk-view.jsx'; import { identity_status_codes, submission_status_code, service_code } from './proof-of-identity-utils'; -import { IdvDocSubmitOnSignup } from '../../../Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup.jsx'; +import { IdvDocSubmitOnSignup } from '../../../Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/idv-doc-submit-on-signup'; import { AutoHeightWrapper } from '@deriv/components'; const POISubmissionForMT5 = ({ diff --git a/packages/cfd/globals.d.ts b/packages/cfd/globals.d.ts index a29d49c4b3ec..3ce6f098901c 100644 --- a/packages/cfd/globals.d.ts +++ b/packages/cfd/globals.d.ts @@ -1,3 +1,7 @@ declare module '@deriv/components'; declare module '@deriv/shared'; declare module '@deriv/account'; +declare module '*.svg' { + const content: React.SVGAttributes; + export default content; +} diff --git a/packages/cfd/tsconfig.json b/packages/cfd/tsconfig.json index dce40b01bd32..6bc53df1d7e3 100644 --- a/packages/cfd/tsconfig.json +++ b/packages/cfd/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "paths": { "_common/*": ["./src/_common/*"], + "Assets/*": ["./src/Assets/*"], "Constants/*": ["./src/Constants/*"], "Components/*": ["./src/Components/*"], "Containers/*": ["./src/Containers/*"], diff --git a/packages/components/src/components/auto-height-wrapper/auto-height-wrapper.tsx b/packages/components/src/components/auto-height-wrapper/auto-height-wrapper.tsx index 5ad9864ccbad..d7a391b95c97 100644 --- a/packages/components/src/components/auto-height-wrapper/auto-height-wrapper.tsx +++ b/packages/components/src/components/auto-height-wrapper/auto-height-wrapper.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { usePrevious } from '../../hooks'; -type TAutoHeightWrapperChildProps = { - height: number | string; - setRef: (ref: HTMLElement) => void; +export type TAutoHeightWrapperChildProps = { + height: number; + setRef: (ref: HTMLFormElement | null) => void; }; type TAutoHeightWrapperProps = { - default_height: number | string; + default_height: number; children: (props: TAutoHeightWrapperChildProps) => React.ReactElement; - height_offset: number | null; + height_offset?: number | null; }; const AutoHeightWrapper = (props: TAutoHeightWrapperProps) => { @@ -31,9 +31,9 @@ const AutoHeightWrapper = (props: TAutoHeightWrapperProps) => { : props.default_height ); - const setRef = (ref: HTMLElement) => { - if (Number.isInteger(ref?.clientHeight) && ref.clientHeight !== prev_child_client_height) { - child_client_height_ref.current = ref.clientHeight; + const setRef = (ref: HTMLFormElement | null) => { + if (Number.isInteger(ref?.clientHeight) && ref?.clientHeight !== prev_child_client_height) { + child_client_height_ref.current = Number(ref?.clientHeight); setTimeout(updateHeight, 0); } }; diff --git a/packages/components/src/components/auto-height-wrapper/index.ts b/packages/components/src/components/auto-height-wrapper/index.ts index 3be84d2b9617..c4890133fd9d 100644 --- a/packages/components/src/components/auto-height-wrapper/index.ts +++ b/packages/components/src/components/auto-height-wrapper/index.ts @@ -1,3 +1,4 @@ -import AutoHeightWrapper from './auto-height-wrapper'; +import AutoHeightWrapper, { TAutoHeightWrapperChildProps } from './auto-height-wrapper'; +export type { TAutoHeightWrapperChildProps }; export default AutoHeightWrapper; diff --git a/packages/components/src/components/themed-scrollbars/themed-scrollbars.tsx b/packages/components/src/components/themed-scrollbars/themed-scrollbars.tsx index 300084e47494..c2f046929505 100644 --- a/packages/components/src/components/themed-scrollbars/themed-scrollbars.tsx +++ b/packages/components/src/components/themed-scrollbars/themed-scrollbars.tsx @@ -6,7 +6,7 @@ type TThemedScrollbars = { autohide?: boolean; className?: string; has_horizontal?: boolean; - height?: string; + height?: number | string; is_bypassed?: boolean; is_only_horizontal?: boolean; is_only_horizontal_overlay?: boolean; diff --git a/packages/components/src/index.js b/packages/components/src/index.js index 897d7785cd21..f2b5c3a46a84 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -10,7 +10,7 @@ // export default { Label, Button }; export { default as Accordion } from './components/accordion'; -export { default as AutoHeightWrapper } from './components/auto-height-wrapper'; +export { default as AutoHeightWrapper, TAutoHeightWrapperChildProps } from './components/auto-height-wrapper'; export { default as Autocomplete } from './components/autocomplete'; export { default as AutoSizer } from './components/autosizer'; export { default as Button } from './components/button'; From ed0f3fcd8a885f7b2de0e4b625b879fc2f419f0f Mon Sep 17 00:00:00 2001 From: tay suisin Date: Fri, 6 Jan 2023 10:52:35 +0800 Subject: [PATCH 2/9] chore: empty commit From 626ad56badae951de49ebe822c404e68df55cb10 Mon Sep 17 00:00:00 2001 From: tay suisin Date: Fri, 6 Jan 2023 10:55:11 +0800 Subject: [PATCH 3/9] chore: remote .jsx from indx file --- packages/account/src/Components/poi/poi-form-on-signup/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account/src/Components/poi/poi-form-on-signup/index.js b/packages/account/src/Components/poi/poi-form-on-signup/index.js index 94a1e091030e..126606374626 100644 --- a/packages/account/src/Components/poi/poi-form-on-signup/index.js +++ b/packages/account/src/Components/poi/poi-form-on-signup/index.js @@ -1,3 +1,3 @@ -import { ProofOfIdentityFormOnSignup } from './poi-form-on-signup.jsx'; +import { ProofOfIdentityFormOnSignup } from './poi-form-on-signup'; export default ProofOfIdentityFormOnSignup; From ac8a28288006dcd1d24949561447a04cab9b5771 Mon Sep 17 00:00:00 2001 From: tay suisin Date: Fri, 6 Jan 2023 11:03:56 +0800 Subject: [PATCH 4/9] chore: remove prop-types --- .../poi/poi-form-on-signup/poi-form-on-signup.tsx | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx b/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx index c1c9bc4fd79c..742f880d0481 100644 --- a/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx +++ b/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import IdvDocSubmitOnSignup from './idv-doc-submit-on-signup'; import { FormikValues } from 'formik'; @@ -48,15 +47,3 @@ export const ProofOfIdentityFormOnSignup = ({ /> ); }; - -ProofOfIdentityFormOnSignup.propTypes = { - onCancel: PropTypes.func, - onSave: PropTypes.func, - onSubmit: PropTypes.func, - value: PropTypes.object, - getCurrentStep: PropTypes.func, - goToPreviousStep: PropTypes.func, - goToNextStep: PropTypes.func, - residence_list: PropTypes.arrayOf(PropTypes.object), - citizen: PropTypes.string, -}; From 795e27491880a340f1c89b49c056f35048f6b2eb Mon Sep 17 00:00:00 2001 From: tay suisin Date: Mon, 9 Jan 2023 12:07:05 +0800 Subject: [PATCH 5/9] chore: remove ts values for constant variables --- .../Components/poi/poi-form-on-signup/poi-form-on-signup.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx b/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx index 742f880d0481..85440a08bddf 100644 --- a/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx +++ b/packages/account/src/Components/poi/poi-form-on-signup/poi-form-on-signup.tsx @@ -25,8 +25,7 @@ export const ProofOfIdentityFormOnSignup = ({ residence_list, citizen, }: TProofOfIdentityFormOnSignup) => { - const citizen_data: FormikValues = - residence_list.find((residence: FormikValues) => residence.value === citizen) || {}; + const citizen_data = residence_list.find((residence: FormikValues) => residence.value === citizen) || {}; const handleSubmit = (values: FormikValues, actions: FormikValues) => { onSubmit(getCurrentStep() - 1, values, actions.setSubmitting, goToNextStep); From 03cca5a1881a4d91036d3201d084268d7dab32d6 Mon Sep 17 00:00:00 2001 From: tay suisin Date: Mon, 9 Jan 2023 14:48:02 +0800 Subject: [PATCH 6/9] chore: remove cfd changes --- packages/cfd/globals.d.ts | 4 ---- packages/cfd/tsconfig.json | 1 - 2 files changed, 5 deletions(-) diff --git a/packages/cfd/globals.d.ts b/packages/cfd/globals.d.ts index 3ce6f098901c..a29d49c4b3ec 100644 --- a/packages/cfd/globals.d.ts +++ b/packages/cfd/globals.d.ts @@ -1,7 +1,3 @@ declare module '@deriv/components'; declare module '@deriv/shared'; declare module '@deriv/account'; -declare module '*.svg' { - const content: React.SVGAttributes; - export default content; -} diff --git a/packages/cfd/tsconfig.json b/packages/cfd/tsconfig.json index 6bc53df1d7e3..dce40b01bd32 100644 --- a/packages/cfd/tsconfig.json +++ b/packages/cfd/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "paths": { "_common/*": ["./src/_common/*"], - "Assets/*": ["./src/Assets/*"], "Constants/*": ["./src/Constants/*"], "Components/*": ["./src/Components/*"], "Containers/*": ["./src/Containers/*"], From 1bd5a06d9feec1ff53df7aa3405932ae5269bddc Mon Sep 17 00:00:00 2001 From: tay suisin Date: Mon, 9 Jan 2023 14:49:23 +0800 Subject: [PATCH 7/9] chore: add Assets for icons --- packages/account/global.d.ts | 4 ++++ packages/account/tsconfig.json | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/account/global.d.ts b/packages/account/global.d.ts index 5ac902685ee5..4fc4d58625ba 100644 --- a/packages/account/global.d.ts +++ b/packages/account/global.d.ts @@ -1 +1,5 @@ declare module '@binary-com/binary-document-uploader'; +declare module '*.svg' { + const content: React.SVGAttributes; + export default content; +} diff --git a/packages/account/tsconfig.json b/packages/account/tsconfig.json index e6ab00429c19..1c2bbfb1afc3 100644 --- a/packages/account/tsconfig.json +++ b/packages/account/tsconfig.json @@ -4,6 +4,7 @@ "outDir": "./dist", "baseUrl": "./", "paths": { + "Assets/*": ["src/Assets/*"], "Components/*": ["src/Components/*"], "Containers/*": ["src/Containers/*"], "Constants/*": ["src/Constants/*"], @@ -13,7 +14,7 @@ "Sections/*": ["src/Sections/*"], "Stores/*": ["src/Stores/*"], "Types": ["src/Types"], - "@deriv/*": ["../*/src"], + "@deriv/*": ["../*/src"] } }, "include": ["src", "globals.d.ts", "../../utils.d.ts"] From 2634d7ac92a12648ccfe76d0abb8204452f3c5d3 Mon Sep 17 00:00:00 2001 From: Sui Sin <103026762+suisin-deriv@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:50:22 +0800 Subject: [PATCH 8/9] Update tsconfig.json add , --- packages/account/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account/tsconfig.json b/packages/account/tsconfig.json index 1c2bbfb1afc3..b78d41877d2d 100644 --- a/packages/account/tsconfig.json +++ b/packages/account/tsconfig.json @@ -14,7 +14,7 @@ "Sections/*": ["src/Sections/*"], "Stores/*": ["src/Stores/*"], "Types": ["src/Types"], - "@deriv/*": ["../*/src"] + "@deriv/*": ["../*/src"], } }, "include": ["src", "globals.d.ts", "../../utils.d.ts"] From a4a39f37f84e0ab2a0fdd05355e7b9c6fb0550e8 Mon Sep 17 00:00:00 2001 From: tay suisin Date: Mon, 9 Jan 2023 15:03:08 +0800 Subject: [PATCH 9/9] chore: change function call in global.d.ts --- packages/account/global.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account/global.d.ts b/packages/account/global.d.ts index 4fc4d58625ba..a492758edbd7 100644 --- a/packages/account/global.d.ts +++ b/packages/account/global.d.ts @@ -1,5 +1,5 @@ declare module '@binary-com/binary-document-uploader'; declare module '*.svg' { - const content: React.SVGAttributes; + const content: React.ElementType>; export default content; }