Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TS type assertion for payout CSV export code for type safety and prevent TypeScript errors #10030

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading