Fix 68 TypeScript compilation errors across codebase#453
Merged
Conversation
Co-authored-by: jamespepper81 <84083764+jamespepper81@users.noreply.github.com>
Fix 68 TypeScript compilation errors across codebase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request focuses on improving type safety, error handling, and code robustness across multiple screens and components in the app. The main changes include stricter type annotations for callback functions and data mapping, safer access to optional service methods, and improved handling of potential null or undefined values. These updates help prevent runtime errors and make the codebase more maintainable.
Type Safety Improvements:
Added explicit type annotations (e.g.,
UTXO,Transaction) to callback functions, array mapping, and filtering in files such ascoin-control.tsx,transaction-details.tsx,transaction-explorer.tsx, andtransaction-history.tsxto ensure type correctness and prevent potential runtime errors. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Updated the
ExtendedTransactionDetailsinterface intransaction-explorer.tsxto more accurately model possible transaction detail responses and preserve type safety, including optional and union-typed fields.Robustness and Error Handling:
Added checks for the existence of service methods such as
clearAddressCacheandgetFirstUnusedReceivingAddressinreceive.tsxto prevent errors if these methods are undefined. [1] [2] [3]Improved fallback logic for accessing price data in
address-details.tsxand for handling potentially undefinedbitcoinPriceintransaction-explorer.tsx. [1] [2] [3]Component and Styling Updates:
Updated the
BitSleuthButtonandBitSleuthCardcomponents to use thelightThemeand improved the mapping of button variants to theme variants for consistent styling. [1] [2] [3]Added a
disabledActionButtonstyle for action buttons intransaction-details.tsxto visually indicate disabled state.Miscellaneous Improvements:
Changed the event subscription type from
EmitterSubscriptiontoNativeEventSubscriptionin_layout.tsxfor better compatibility with the React Native API. [1] [2]Fixed loading state logic in the wallet addresses screen to use the correct data source for determining if addresses are loading.