Remove unsafe type assertions from search, selection, payments, and Plaid - #98854
Draft
KJ21-ENG wants to merge 2 commits into
Draft
Remove unsafe type assertions from search, selection, payments, and Plaid#98854KJ21-ENG wants to merge 2 commits into
KJ21-ENG wants to merge 2 commits into
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
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.
Explanation of Change
Removes thirteen unsafe type assertions from four cleanup targets while preserving their existing contracts. Search filter values are narrowed before card, feed, and tax-rate lookup; section flattening retains each section item type without a cast-only
flatIndex; payment methods are discriminated by their bank fields; and Plaid institution metadata is narrowed by its platform-specific identifier. The Search filter regression test covers both scalar and comma-joined card IDs.Fixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Count change
Current baseline source:
config/eslint/eslint.seatbelt.tsvat base36b1102184013c05064c481e5e09954137394aae.Before:
src/components/Search/SearchPageHeader/SearchFilterBar.tsx: 3 violationssrc/components/SelectionList/hooks/useFlattenedSections.ts: 3 violationssrc/hooks/useBulkPayOptions.ts: 3 violationssrc/pages/settings/Wallet/PersonalCards/steps/PlaidConnectionStep.tsx: 4 violationsAfter:
src/components/Search/SearchPageHeader/SearchFilterBar.tsx: 0 violationssrc/components/SelectionList/hooks/useFlattenedSections.ts: 0 violationssrc/hooks/useBulkPayOptions.ts: 0 violationssrc/pages/settings/Wallet/PersonalCards/steps/PlaidConnectionStep.tsx: 0 violationsNet reduction:
TSV evidence:
config/eslint/eslint.seatbelt.tsvbyte-for-byte after confirming zero cleanup findings across all four targets and both approved support paths.Tests
tests/unit/Search/SearchFilterBarTest.tsx, covering one scalar card ID and multiple comma-joined card IDs.src/components/AddressSearch/index.tsx, so exact-head Fork CI remained mandatory.git diff --check, changed-path proof, and generated-TSV restoration passed.32122086149passed typecheck, lint, format, React Compiler, and Jest at signed commit1c43df2cf0023a0cab0119225bd9447c52260d7d.No manual application testing was performed; the evidence above is automated verification and independent review.
Offline tests
N/A: this type-safety cleanup does not change network or offline behavior, and no manual offline testing was performed.
QA Steps
N/A: no product behavior is intended to change. Search card-label behavior is covered by the focused regression test, and the complete exact head passed Fork CI.
PR Author Checklist
N/A rationale: no UI, copy, CSS, assets, networking, deeplink, Storybook story, messaging flow, or new feature is introduced. No manual platform, high-traffic-account, offline, console, screenshot/video, staging, or production testing was performed. The affected Search, SelectionList, payment-option, and Plaid contracts were examined during planning and independent review, and exact-head CI covered the full repository checks. Every item below was considered against that scope.
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
N/A: no UI or visual behavior changed, and no screenshots or videos were produced.
Changed files (6)
src/components/Search/SearchPageHeader/SearchFilterBar.tsxsrc/components/SelectionList/SelectionListWithSections/types.ts(reserved support path)src/components/SelectionList/hooks/useFlattenedSections.tssrc/hooks/useBulkPayOptions.tssrc/pages/settings/Wallet/PersonalCards/steps/PlaidConnectionStep.tsxtests/unit/Search/SearchFilterBarTest.tsx(reserved support path)