Remove unsafe type assertions from emoji, selection, and sound utilities - #98879
Draft
KJ21-ENG wants to merge 1 commit into
Draft
Remove unsafe type assertions from emoji, selection, and sound utilities#98879KJ21-ENG wants to merge 1 commit into
KJ21-ENG wants to merge 1 commit into
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
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 12 unsafe type assertions from emoji indexing, selection serialization, and native sound loading while preserving existing behavior. EmojiTrie now uses its concrete generic and discriminated emoji shapes, SelectionScraper transforms concrete domhandler nodes while maintaining parent and sibling links, and native sound assets use typed static imports. Focused tests pin ordinary HTML, MathML relationships, and SVG
foreignObjectserialization.Fixed Issues
$ #94739
PROPOSAL: #94739 (comment)
Count change
Current baseline source:
config/eslint/eslint.seatbelt.tsvat basee69182c5379d82f41b6c9d6b7c7237d2c1cb0dd1.Before:
src/libs/EmojiTrie.ts: 4 violationssrc/libs/SelectionScraper/index.ts: 4 violationssrc/libs/Sound/index.native.ts: 4 violationsAfter:
src/libs/EmojiTrie.ts: 0 violationssrc/libs/SelectionScraper/index.ts: 0 violationssrc/libs/Sound/index.native.ts: 0 violationsNet reduction:
TSV evidence:
config/eslint/eslint.seatbelt.tsvbyte-for-byte after confirming zero cleanup findings in every target.Tests
tests/unit/SelectionScraperTest.ts, covering ordinary HTML transformation, coherent MathML parent/sibling relationships, and pinned SVGforeignObjectserialization.src/components/AddressSearch/index.tsx.git diff --check, changed-path proof, cleanup counts, and generated-TSV restoration passed.32134600292passed typecheck, lint, format, React Compiler, and Jest at signed commit725c368887968221c812d1ffbf610d47ee13eff2.N/A: this is a behavior-preserving type-safety cleanup with no standalone manual application flow or JS-console behavior to exercise.
Offline tests
N/A: this cleanup does not change networking or offline behavior.
QA Steps
N/A: existing emoji indexing, selection serialization, and sound-asset behavior are preserved and covered by focused verification, regression tests, independent reviews, and exact-head CI.
PR Author Checklist
N/A rationale: manual platform, high-traffic-account, screenshots, assets, CSS, UI, copy, deeplink, Storybook, messaging, feature/bug-flow, and post-review-main-merge checks do not apply because this PR is a behavior-preserving type-safety cleanup and has not merged
mainafter review. Selection serialization, emoji indexing, native sound loading, and affected consumers were examined during planning, focused tests, verification, and independent review. 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 behavior changed.
Changed files (5)
src/libs/EmojiTrie.tssrc/libs/SelectionScraper/index.tssrc/libs/Sound/index.native.tssrc/types/global.d.ts(reserved support path)tests/unit/SelectionScraperTest.ts(reserved support path)