[Payment due @ShridharGoel] Fix unsafe type assertions flagged by the seatbelt bump [No QA]#93105
Conversation
|
@ShridharGoel Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
| "../../src/libs/SearchAutocompleteUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 4 | ||
| "../../src/libs/SearchQueryUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 73 | ||
| "../../src/libs/SearchUIUtils.ts" "@typescript-eslint/no-unsafe-type-assertion" 71 | ||
| "../../src/libs/SearchUIUtils.ts" "@typescript-eslint/no-deprecated/getSearchReportName" 1 |
There was a problem hiding this comment.
Do we need this new entry?
There was a problem hiding this comment.
Yes — this entry came in via the merge commit that brought our branch up to date with main. A recently merged PR (f1c9bc6c12a) introduced a call to the (deprecated) getSearchReportName function in SearchUIUtils.ts, so the seatbelt needs to track it. This PR isn't the right place to fix a no-deprecated violation — but removing the entry would cause the lint check to fail since the actual call is still there.
|
@ShridharGoel we had to merge main to resolve conflicts. Can you give a quick second pass? |
|
Yes, my initial review was after merging main. So we should be good here but I'll have a quick look again. |
|
🎯 @ShridharGoel, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
🚧 @yuwenmemon has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.5-0 🚀
Bundle Size Analysis (Sentry): |
Help site review: no changes requiredI reviewed the changes in this PR against Expensify's help site files under Why: This PR is a type-level and lint-only cleanup with no runtime or user-facing behavior changes. Specifically, it:
None of these touch UI copy, feature names, tab/setting labels, buttons, or any documented behavior. The PR description itself confirms: "No runtime behavior changes — this is type-level and lint cleanup." Since no help site changes are needed, I did not create a draft docs PR. @yuwenmemon, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR (Note: no help site PR was created because this PR introduces no user-facing or documented behavior changes.) |
|
🤖 Payment issue created: #93345 |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.5-6 🚀
|
Explanation of Change
A recent seatbelt bump grandfathered new
@typescript-eslint/no-unsafe-type-assertionviolations onmaininstead of fixing them. This is the follow-up that actually fixes the cleanly-fixable ones and tightens the seatbelt baseline back down so the count can't silently creep up again.What got tightened:
src/components/MoneyRequestConfirmationList/sections/selectors.ts: 7 → 3. The footer slice selectors declared a fullOnyxEntry<Transaction>return type but only build a narrow slice, so they cast withas Transaction. Four now return their real slice type (no cast) —getTagForDisplay/getTagandgetTagVisibilitywere narrowed to thetagfield they actually read, andisScanRequest/getCurrency/isManagedCardTransactionnow accept just the fields they read. The remaining 3 (distanceMap,perDiem,receipt) feed into a web of shared receipt/waypoint/per-diem utils, so type-safely narrowing them is a larger refactor left out of scope here.src/libs/Navigation/Navigation.ts: 11 → 10.originalTabRoute.stateis already typed as the navigation-state union, so theas NavigationStatenarrowing was unnecessary and is removed.src/libs/SearchUIUtils.ts: 71 → 69.getPolicyCategoriesForPolicyIDused two casts to discriminate thePolicyCategoriesLookupunion; a small type guard does it without assertions.tests/unit/Search/SearchUIUtilsTest.ts: 135 → 133. The two newgetSortedSections(...) as TransactionListItemType[]casts are replaced with anincheck when readingtransactionID.No runtime behavior changes — this is type-level and lint cleanup.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/625136
Tests
npm run typecheckand verify it passes.npm run lintand verify there are no new ESLint errors (the seatbelt counts for the four files above are lower, not higher).npx jest tests/unit/Search/SearchUIUtilsTest.tsand verify the SearchUIUtils tests pass, including "should sort expense data by category GL code using policy categories".Offline tests
N/A — type-level and lint-only change with no runtime behavior change.
QA Steps
// [No QA]
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — type-level and lint-only change.
Android: mWeb Chrome
N/A — type-level and lint-only change.
iOS: Native
N/A — type-level and lint-only change.
iOS: mWeb Safari
N/A — type-level and lint-only change.
MacOS: Chrome / Safari
N/A — type-level and lint-only change.