Skip to content

Commit

Permalink
Add TS type assertion for payout CSV export code for type safety and …
Browse files Browse the repository at this point in the history
…prevent TypeScript errors (#10030)

Co-authored-by: Nagesh Pai <[email protected]>
  • Loading branch information
nagpai and Nagesh Pai authored Dec 24, 2024
1 parent 504a42c commit 21d5cf8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
5 changes: 5 additions & 0 deletions changelog/dev-10029-export-deposit-type-assert
Original file line number Diff line number Diff line change
@@ -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


35 changes: 19 additions & 16 deletions client/deposits/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 21d5cf8

Please sign in to comment.