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 + + 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',