Skip to content

Commit

Permalink
Add TS type assertion for disputes CSV export API response to fix typ…
Browse files Browse the repository at this point in the history
…e safety (#10008)

Co-authored-by: Shendy <[email protected]>
  • Loading branch information
Jinksi and shendy-a8c authored Dec 23, 2024
1 parent 23516e9 commit 49b6961
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Add type assertion for disputes CSV export response to ensure type safety and fix TypeScript error
35 changes: 19 additions & 16 deletions client/disputes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 49b6961

Please sign in to comment.