Skip to content

Fix 68 TypeScript compilation errors across codebase#452

Merged
jamespepper81 merged 2 commits into
devfrom
copilot/fix-typescript-errors
Jan 11, 2026
Merged

Fix 68 TypeScript compilation errors across codebase#452
jamespepper81 merged 2 commits into
devfrom
copilot/fix-typescript-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 11, 2026

TypeScript compilation was failing with 68 strict mode errors across app screens, components, hooks, and services. These errors blocked CI builds and development workflows.

Changes

Wallet Service Integration

  • Added missing clearAddressCache and getFirstUnusedReceivingAddress to wallet-store exports
  • Added null guards for optional wallet service methods in receive.tsx
  • Exposed priceQuery in wallet-store balanceData for price queries

Type Safety Improvements

  • Added explicit type annotations for array callbacks in coin-control, transaction-explorer, transaction-history, and PriceChart
  • Fixed ExtendedTransactionDetails interface to handle both status object ({confirmed: boolean, block_height?: number}) and status string union
  • Replaced EmitterSubscription with NativeEventSubscription in _layout.tsx for appearance listener
  • Handled string | number cache value types in cpfp-service and rbf-service derivation functions

Component Fixes

  • Imported missing platformStyles in EmojiReaction, PremiumButton, and SuccessAnimation
  • Converted ConfettiCelebration position from percentage string to pixel number using screen dimensions
  • Added disabledActionButton style to transaction-details
  • Typed LinearGradient colors as readonly tuples: readonly [string, string]
  • Mapped incompatible variant props to valid theme variants in BitSleuthButton and BitSleuthCard
  • Fixed conditional style expressions to return null instead of false

Service Fixes

  • Scoped testPrivateKey declarations in rbf-service ECC verification blocks (was referencing undefined variable)
  • Cast array elements in ecc-override hex logging to handle unknown[] from Array.from()
  • Imported React in use-performance-monitor for HOC types

Example fix for cache value handling:

// Before: assumes cache always returns number
const cachedIndex = addressIndexCache.get(targetAddress)!;
return cachedIndex;

// After: handles string|number cache values
const cachedValue = addressIndexCache.get(targetAddress)!;
const cachedIndex = typeof cachedValue === 'string' 
  ? parseInt(cachedValue.split(':')[1], 10)
  : cachedValue;
return cachedIndex;

All changes preserve existing runtime behavior while satisfying TypeScript strict mode.

Original prompt

can you look into and try to fix these TypeScript errors?

Error: app/(tabs)/receive.tsx(68,9): error TS2722: Cannot invoke an object which is possibly 'undefined'.
Error: app/(tabs)/receive.tsx(89,37): error TS2722: Cannot invoke an object which is possibly 'undefined'.
Error: app/(tabs)/receive.tsx(89,37): error TS18048: 'walletService.getFirstUnusedReceivingAddress' is possibly 'undefined'.
Error: app/(tabs)/receive.tsx(189,39): error TS2722: Cannot invoke an object which is possibly 'undefined'.
Error: app/(tabs)/receive.tsx(189,39): error TS18048: 'walletService.getFirstUnusedReceivingAddress' is possibly 'undefined'.
Error: app/_layout.tsx(66,5): error TS2740: Type 'NativeEventSubscription' is missing the following properties from type 'EmitterSubscription': emitter, listener, context, eventType, and 2 more.
Error: app/address-details.tsx(52,82): error TS2339: Property 'priceQuery' does not exist on type '{ isCreatingWallet: boolean; setAddressStatsCache: (key: string, stats: { balance: number; }) => void; getAddressStatsCacheValue: (key: string) => { balance: number; } | undefined; getMnemonic: (walletId: string) => Promise<...>; ... 57 more ...; isLoading: boolean; }'.
Error: app/coin-control.tsx(95,33): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(134,35): error TS7006: Parameter 'a' implicitly has an 'any' type.
Error: app/coin-control.tsx(134,38): error TS7006: Parameter 'b' implicitly has an 'any' type.
Error: app/coin-control.tsx(158,68): error TS7006: Parameter 'u' implicitly has an 'any' type.
Error: app/coin-control.tsx(170,29): error TS7006: Parameter 'item' implicitly has an 'any' type.
Error: app/coin-control.tsx(184,31): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(201,15): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(202,12): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(269,15): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(270,16): error TS7006: Parameter 'sum' implicitly has an 'any' type.
Error: app/coin-control.tsx(270,21): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(274,43): error TS7006: Parameter 'sum' implicitly has an 'any' type.
Error: app/coin-control.tsx(274,48): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/coin-control.tsx(605,42): error TS7006: Parameter 'utxo' implicitly has an 'any' type.
Error: app/transaction-details.tsx(46,36): error TS7006: Parameter 't' implicitly has an 'any' type.
Error: app/transaction-details.tsx(432,69): error TS2339: Property 'disabledActionButton' does not exist on type '{ container: { flex: number; }; scrollView: { flex: number; paddingTop: number; }; centerContent: { flex: number; justifyContent: "center"; alignItems: "center"; }; errorText: { textAlign: "center"; fontSize: number; lineHeight: number; letterSpacing: number; fontWeight: "500"; }; ... 27 more ...; refreshText: { ......'.
Error: app/transaction-details.tsx(448,70): error TS2339: Property 'disabledActionButton' does not exist on type '{ container: { flex: number; }; scrollView: { flex: number; paddingTop: number; }; centerContent: { flex: number; justifyContent: "center"; alignItems: "center"; }; errorText: { textAlign: "center"; fontSize: number; lineHeight: number; letterSpacing: number; fontWeight: "500"; }; ... 27 more ...; refreshText: { ......'.
Error: app/transaction-explorer.tsx(86,11): error TS2430: Interface 'ExtendedTransactionDetails' incorrectly extends interface 'Transaction'.
Types of property 'confirmations' are incompatible.
Type 'number | undefined' is not assignable to type 'number'.
Type 'undefined' is not assignable to type 'number'.
Error: app/transaction-explorer.tsx(126,42): error TS7006: Parameter 't' implicitly has an 'any' type.
Error: app/transaction-explorer.tsx(147,71): error TS2345: Argument of type '{ usd: number; usd_24h_change: number; USD: { last: number; }; } | undefined' is not assignable to parameter of type '{ usd?: number | undefined; } | null'.
Type 'undefined' is not assignable to type '{ usd?: number | undefined; } | null'.
Error: app/transaction-explorer.tsx(158,55): error TS2345: Argument of type '{ usd: number; usd_24h_change: number; USD: { last: number; }; } | undefined' is not assignable to parameter of type '{ usd?: number | undefined; } | null'.
Type 'undefined' is not assignable to type '{ usd?: number | undefined; } | null'.
Error: app/transaction-explorer.tsx(695,82): error TS2339: Property 'vin' does not exist on type 'Transaction'.
Error: app/transaction-explorer.tsx(696,85): error TS2339: Property 'vout' does not exist on type 'Transaction'.
Error: app/transaction-explorer.tsx(711,47): error TS7006: Parameter 'sum' implicitly has an 'any' type.
Error: app/transaction-explorer.tsx(711,52): error TS7006: Parameter 'vin'...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Jan 11, 2026
Co-authored-by: jamespepper81 <84083764+jamespepper81@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TypeScript errors in receive and layout files Fix 68 TypeScript compilation errors across codebase Jan 11, 2026
Copilot AI requested a review from jamespepper81 January 11, 2026 19:51
@jamespepper81 jamespepper81 marked this pull request as ready for review January 11, 2026 19:58
@jamespepper81 jamespepper81 merged commit 763218d into dev Jan 11, 2026
3 checks passed
@jamespepper81 jamespepper81 deleted the copilot/fix-typescript-errors branch January 11, 2026 19:58
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