refactor(image-tooltip): migrate ImageTooltip from Flow to TypeScript - #4770
refactor(image-tooltip): migrate ImageTooltip from Flow to TypeScript#4770bonchevskyi wants to merge 1 commit into
Conversation
Walkthrough
ChangesImageTooltip TypeScript migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/image-tooltip/getTestImageSrc.ts (1)
1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer
@ts-expect-erroror add a shared PNG declaration.
@ts-ignoresuppresses every diagnostic on the import. Use@ts-expect-errorwhen the missing declaration is intentional, or add a shared*.pngdeclaration and remove the suppression.The supplied TypeScript context states that the directive exists because the PNG asset has no declaration; verify the repository's ambient asset declarations before choosing the fix.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/image-tooltip/getTestImageSrc.ts` around lines 1 - 2, Replace the broad `@ts-ignore` on the testImageSrc PNG import with `@ts-expect-error` if the repository lacks an ambient PNG declaration; otherwise add or reuse a shared *.png declaration and remove the suppression. Verify existing asset declarations before selecting the approach.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/image-tooltip/ImageTooltipContent.tsx`:
- Around line 6-15: Restore the public export on the ImageTooltipContentProps
interface so consumers can continue importing this type from the module.
Preserve the existing interface fields and contract; only update its declaration
visibility.
---
Nitpick comments:
In `@src/components/image-tooltip/getTestImageSrc.ts`:
- Around line 1-2: Replace the broad `@ts-ignore` on the testImageSrc PNG import
with `@ts-expect-error` if the repository lacks an ambient PNG declaration;
otherwise add or reuse a shared *.png declaration and remove the suppression.
Verify existing asset declarations before selecting the approach.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 452ab25d-bb0e-46c2-8127-57f2ff94af12
📒 Files selected for processing (8)
src/components/image-tooltip/ImageTooltip.stories.tsxsrc/components/image-tooltip/ImageTooltip.tsxsrc/components/image-tooltip/ImageTooltipContent.tsxsrc/components/image-tooltip/__tests__/ImageTooltip.test.tsxsrc/components/image-tooltip/__tests__/ImageTooltipContent.test.tsxsrc/components/image-tooltip/getTestImageSrc.js.flowsrc/components/image-tooltip/getTestImageSrc.tssrc/components/image-tooltip/index.ts
💤 Files with no reviewable changes (3)
- src/components/image-tooltip/tests/ImageTooltipContent.test.tsx
- src/components/image-tooltip/tests/ImageTooltip.test.tsx
- src/components/image-tooltip/ImageTooltip.stories.tsx
a33411d to
7307fb5
Compare
Convert ImageTooltip component to TypeScript
This PR converts
src/components/image-tooltipfrom JavaScript with Flow to TypeScript.Changes
getTestImageSrc.jstogetTestImageSrc.ts(remaining Flow module in an otherwise TypeScript folder)ImageTooltipProps/ImageTooltipContentPropsto interfaces; re-exportedImageTooltipPropsfromindex.tsgetTestImageSrc.js.flowfor backward compatibility@ts-ignore flow importdirectives now that Tooltip andgetTestImageSrcare TypeScriptContract
Testing
src/components/image-tooltip; all 2 pass with snapshots matching previous outputyarn lint:tsandflow checkpassComponents/ImageTooltip) that behavior is unchangedSummary by CodeRabbit
Refactor
Tests