Skip to content

fix: correct the type errors introduced in #1290 - #1292

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
SagaciousBoss:fix/1290-type-errors
Oct 17, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
SagaciousBoss:fix/1290-type-errors

Conversation

@SagaciousBoss

Copy link
Copy Markdown
Contributor

Follow-up to #1290, which merged with four type errors that only the Docker build job (tsc) caught — the backend CI jobs run eslint and vitest, neither of which type-checks. #1290 passed Backend (Node.js 20) and Backend (Node.js 22).

What was wrong

  • backend/src/services/fiat-crypto.ts — const conversions = Map<string, ConversionRecord>() was missing new. That also made Array.from(conversions.values()) an unknown[], which broke the element types in listConversions.
  • backend/src/services/payouts/payout-engine.ts — evaluatePayouts called the async materialiseBatch without awaiting it, so it pushed a Promise into a PayoutBatch[], and the per-schedule try/catch could not observe a failure.
  • backend/src/routes/payouts.ts — req.params.batchId is typed string | string[] under this Express version. The handlers now resolve the id once through requireId and reuse the validated string, which also removes the repeated param lookup.

Two smaller robustness changes while in the same code:

  • The FX rate lookup and the payout asset-scale lookup use Object.prototype.hasOwnProperty.call rather than comparing the result to undefined, which keeps them honest if a rate is ever legitimately falsy.
  • The settlement amount parse moved into parseSettlementAmount, which collapses every failure mode onto the single INVALID_SETTLEMENT_AMOUNT sentinel instead of relying on definite-assignment analysis across a try/catch.

Scope

Three files, no behaviour change beyond fixing the above. Backend (Node.js 20/22) on #1290 passed, so the test suite already covered this code; this commit makes tsc agree.

Verification

npm run test --workspace backend and npm run lint --workspace backend. The repository-wide tsc build has a large number of pre-existing errors unrelated to this change (missing modules, ungenerated Prisma client, websocket.ts, tax-engine.ts, featureFlagRegistry.ts and others); this commit removes the only ones introduced by #1290.

Closes #1184
Closes #1185
Closes #1186

…rtdevs17#1290

Four defects introduced in Smartdevs17#1290 that the backend lint+test jobs do not catch
because they only run eslint and vitest, neither of which type-checks:

- fiat-crypto.ts: const conversions = Map<string, ConversionRecord>() was missing

ew, which also made Array.from(conversions.values()) an unknown[] and broke
  the element types in listConversions.
- payout-engine.ts: evaluatePayouts called the async materialiseBatch without
  awaiting it, so it pushed a Promise into the returned PayoutBatch[] and the
  try/catch could not observe a per-schedule failure.
- routes/payouts.ts: 
eq.params.batchId is typed string | string[] under this
  Express version. The handlers now resolve the id once through requireId and reuse
  the validated string, which also removes the repeated param lookup.
- Also replaced the === undefined rate/scale lookups with hasOwnProperty checks
  and moved the settlement amount parse into a helper, so neither can trip the
  type checker or trip over a definite-assignment analysis.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@SagaciousBoss Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown

@SagaciousBoss is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
github-actions Bot merged commit bbdef79 into Smartdevs17:main Oct 17, 2026
16 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strengthen payment security (iteration 11) Improve payout reliability (iteration 11) Fix payment correctness bugs (iteration 10)

1 participant