Skip to content

fix(types): clear 110 of the 280 tsc errors blocking CI - #543

Merged
johdanike merged 2 commits into
SwiftChainn:mainfrom
AdaBebe0:fix/type-errors-ci
Sep 1, 2026
Merged

fix(types): clear 110 of the 280 tsc errors blocking CI#543
johdanike merged 2 commits into
SwiftChainn:mainfrom
AdaBebe0:fix/type-errors-ci

Conversation

@AdaBebe0

@AdaBebe0 AdaBebe0 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Stacked on #542. That PR fixes the 4 ESLint errors that stop CI before Type Check ever runs; this one is the next step. #542's commit is included here, so merge it first.

What this does

pnpm run type-check reports 280 errors. This brings it to 170. Every fix is mechanical — no production behaviour changes.

Change Errors
tsconfig.json — exclude cypress 63
PaymentLock.test.tsxas const made Partial<typeof DEFAULT_HOOK_STATE> reject every override; typed as CurrencyConversionResult 26
imageCompressionService.test.tsbrowser-image-compression resolves a File, not a Blob 10
proofService.test.tsimageCompression is a function, needs jest.MockedFunction not jest.Mocked 3
feeService.test.ts, csvExport.test.ts — strict-mode indexing of jest mock.calls tuples 6
trackingService.test.tsisAxiosError is a type guard; stub via mockImplementation 1
types/delivery.ts — import DeliveryStatus from ./filters, where it's declared 1

On the Cypress exclusion: the two specs under cypress/e2e/ are orphaned. Cypress isn't in package.json, there's no cypress.config.*, and jest's testMatch doesn't pick up .cy.ts. So cy was unresolvable and 63 errors came from files nothing in the repo can actually run. If e2e is wanted, adding Cypress properly is its own PR.

Verification

  • pnpm run lint → 0 errors
  • pnpm run type-check → 170 errors (was 280)
  • All 5 touched test suites pass — 87 tests

The remaining 170 are not cleanup

I stopped here deliberately. What's left needs product decisions, not mechanical fixes:

  • ~73 — walletService is missing methods that shipped code already calls. getTransactionStatus, connect, disconnect, getBalance, getPendingMultiSigOperations. hooks/useTxTracker.ts and hooks/useMultiSigApprovals.ts are in the tree calling these today. Someone needs to decide what these do and which endpoints they hit.
  • ~45 — services/escrowService.ts is unfinished scaffolding. It imports stellar-sdk, which is not a dependency and has never been installed, and @/lib/wallet, which does not exist (the import comment literally reads "Assume a utility to get a connected wallet instance"). It also doesn't export EscrowDetails, lacks openDispute, and returns a shape useEscrowRelease doesn't expect. Fixing this means adding a blockchain SDK and building a wallet lib.
  • ~8 — two conflicting useTheme implementations. hooks/useTheme.ts is hand-rolled against a ThemeService class that doesn't exist, while hooks/__tests__/useTheme.test.ts and components/ui/ThemeToggle.tsx expect a next-themes-based hook with resolvedTheme/toggleTheme. Two PRs landed incompatible versions; someone has to pick one.
  • ~9 — test files importing modules that were never added. @/components/FleetMap, @/components/DashboardMetrics, @/services/metricsService, mapbox-gl, ../HandoffQR, ../services/shipmentHandoffService.

Happy to take any of these on once there's a decision on the intended behaviour.

CI has been red on main for every recent push because `pnpm run lint`
exits 1 on 4 errors (the 254 warnings are non-blocking). Nothing after
the Lint step has been running as a result.

- components/mobile/MobileFooter.tsx: the file was committed with every
  quote character stripped, so the leading backtick opened a template
  literal that never closed and the whole file failed to parse. Restored
  the string quoting; no behaviour change intended.
- app/page.tsx: <KineticExplorer /> was rendered without being imported
  (react/jsx-no-undef). Added the missing import.
- hooks/useDriverReputation.ts: the effect called setState synchronously
  (react-hooks/set-state-in-effect). The settled result now carries the
  driverId it belongs to, so loading is derived rather than written back
  into state from the effect.
- hooks/useTheme.ts: updateTheme was read by an effect declared above it
  (react-hooks/immutability). Hoisted it into a useCallback keyed on
  userId and added it to the effect deps.

Lint now reports 0 errors. Type-check still fails on 280 pre-existing
errors across 44 files, which is out of scope here.
Second step after the lint fix. `pnpm run type-check` reported 280
errors; this brings it to 170. Every fix here is mechanical — no
production behaviour changes.

- tsconfig.json: exclude `cypress`. The two specs under cypress/e2e are
  orphaned — Cypress is not a dependency, there is no cypress.config,
  and jest's testMatch does not pick them up — so `cy` was unresolvable
  and produced 63 errors on files nothing can run.
- types/delivery.ts: import DeliveryStatus from ./filters, where it is
  actually declared.
- PaymentLock.test.tsx: DEFAULT_HOOK_STATE was `as const`, so its literal
  types made Partial<typeof ...> reject every override. Typed it as
  CurrencyConversionResult instead (26 errors).
- imageCompressionService.test.ts: browser-image-compression resolves a
  File, not a Blob; the mock helper now builds a File (10 errors).
- proofService.test.ts: imageCompression is a function, so it needs
  jest.MockedFunction, not jest.Mocked, to expose mockResolvedValue.
- trackingService.test.ts: isAxiosError is a type guard; stub it through
  mockImplementation rather than assigning over the declared signature.
- feeService.test.ts, csvExport.test.ts: strict-mode indexing of
  jest mock.calls tuples.

Affected suites all pass (87 tests across the 5 touched test files).

Remaining 170 errors are NOT mechanical and are deliberately left alone:
~73 from walletService missing getTransactionStatus / connect /
disconnect / getBalance / getPendingMultiSigOperations, which shipped
hooks already call; ~45 from services/escrowService.ts, which imports
'stellar-sdk' (not a dependency) and '@/lib/wallet' (does not exist);
~8 from two conflicting useTheme implementations; ~9 from test files
importing modules that were never added. Each needs a product decision.
@johdanike
johdanike merged commit 6d12af4 into SwiftChainn:main Sep 1, 2026
0 of 2 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.

2 participants