From 7441207135d827dabc71eac3027b2b880212dff6 Mon Sep 17 00:00:00 2001 From: Nagesh Pai Date: Mon, 23 Dec 2024 18:20:11 +0530 Subject: [PATCH 1/2] Add type assertion for exported_deposits --- client/deposits/list/index.tsx | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/client/deposits/list/index.tsx b/client/deposits/list/index.tsx index dc3e20ac02a..52194cb184f 100644 --- a/client/deposits/list/index.tsx +++ b/client/deposits/list/index.tsx @@ -260,22 +260,25 @@ export const DepositsList = (): JSX.Element => { window.confirm( confirmMessage ) ) { try { - const { exported_deposits: exportedDeposits } = await apiFetch( - { - path: getDepositsCSV( { - userEmail, - locale, - dateAfter, - dateBefore, - dateBetween, - match, - statusIs, - statusIsNot, - storeCurrencyIs, - } ), - method: 'POST', - } - ); + const { + exported_deposits: exportedDeposits, + } = await apiFetch< { + /** The total number of payouts that will be exported in the CSV */ + exported_deposits: number; + } >( { + path: getDepositsCSV( { + userEmail, + locale, + dateAfter, + dateBefore, + dateBetween, + match, + statusIs, + statusIsNot, + storeCurrencyIs, + } ), + method: 'POST', + } ); createNotice( 'success', From 33ffee717345176f2edb8c7949072bc2a1eca2c7 Mon Sep 17 00:00:00 2001 From: Nagesh Pai Date: Mon, 23 Dec 2024 18:29:07 +0530 Subject: [PATCH 2/2] Add change log --- changelog/dev-10029-export-deposit-type-assert | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/dev-10029-export-deposit-type-assert diff --git a/changelog/dev-10029-export-deposit-type-assert b/changelog/dev-10029-export-deposit-type-assert new file mode 100644 index 00000000000..684727000a7 --- /dev/null +++ b/changelog/dev-10029-export-deposit-type-assert @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Add type assertion for payouts CSV export response to ensure type safety and fix TypeScript linting error + +