diff --git a/changelog/fix-10007-disputes-csv-export-response-type-assertion b/changelog/fix-10007-disputes-csv-export-response-type-assertion new file mode 100644 index 00000000000..b578456ece2 --- /dev/null +++ b/changelog/fix-10007-disputes-csv-export-response-type-assertion @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Add type assertion for disputes CSV export response to ensure type safety and fix TypeScript error diff --git a/client/disputes/index.tsx b/client/disputes/index.tsx index 6e8c4d2d61b..ad5e8258d7f 100644 --- a/client/disputes/index.tsx +++ b/client/disputes/index.tsx @@ -397,22 +397,25 @@ export const DisputesList = (): JSX.Element => { window.confirm( confirmMessage ) ) { try { - const { exported_disputes: exportedDisputes } = await apiFetch( - { - path: getDisputesCSV( { - userEmail, - locale, - dateAfter, - dateBefore, - dateBetween, - match, - filter, - statusIs, - statusIsNot, - } ), - method: 'POST', - } - ); + const { + exported_disputes: exportedDisputes, + } = await apiFetch< { + /** The total number of disputes that will be exported in the CSV. */ + exported_disputes: number; + } >( { + path: getDisputesCSV( { + userEmail, + locale, + dateAfter, + dateBefore, + dateBetween, + match, + filter, + statusIs, + statusIsNot, + } ), + method: 'POST', + } ); createNotice( 'success',