Skip to content

[CLOV-64] BpkStarRating Migrate JS to TypeScript#4523

Open
Vincent Liu (xiaogliu) wants to merge 2 commits into
mainfrom
xiaogliu/star-rating-to-ts
Open

[CLOV-64] BpkStarRating Migrate JS to TypeScript#4523
Vincent Liu (xiaogliu) wants to merge 2 commits into
mainfrom
xiaogliu/star-rating-to-ts

Conversation

@xiaogliu
Copy link
Copy Markdown
Contributor

Summary

  • Convert the bpk-component-star-rating package from JavaScript/Flow to TypeScript
  • Rename source/test files (.js -> .ts/.tsx) and snapshot files (*-test.js.snap -> *-test.tsx.snap) so Jest still finds them under the new test filenames
  • Replace propTypes + Flow Props with typed Props exports for BpkStar, BpkStarRating, BpkInteractiveStar, BpkInteractiveStarRating, re-exported from index.ts as BpkStarProps, BpkStarRatingProps, BpkInteractiveStarProps, BpkInteractiveStarRatingProps
  • Convert STAR_TYPES to as const and derive a StarType union
  • Migrate withInteractiveStarRatingState to a generic class component (P extends object) with a public static displayName: string field
  • Drop the now-unused @ts-expect-error suppressions on the index/component imports in the stories file
  • No business-logic, JSX, or rendering changes - existing snapshots remain valid

Test plan

  • npm run jest -- packages/backpack-web/src/bpk-component-star-rating - 7 suites, 42 tests, 30 snapshots all pass
  • npx tsc --noEmit - no errors in bpk-component-star-rating
  • npx eslint packages/backpack-web/src/bpk-component-star-rating - no errors, no warnings

🤖 Generated with Claude Code

Convert the bpk-component-star-rating package from JavaScript/Flow to
TypeScript. Replace prop-types and Flow types with typed Props exports
and rename all source/test/snapshot files (.js -> .ts/.tsx). No
business-logic, JSX, or rendering changes - existing snapshots remain
valid.

- Rename index.js -> index.ts and re-export per-component *Props types
- Rename BpkStar/BpkStarRating/BpkInteractiveStar/BpkInteractiveStarRating
  to .tsx with typed Props exports; keep className?: string | null and
  destructuring defaults in place of defaultProps
- Convert STAR_TYPES to as const and derive a StarType union
- Migrate withInteractiveStarRatingState to .tsx with a generic class
  component and a public static displayName field
- Rename themeAttributes/accessibility/themeAttributes-test files
- Rename snapshot files to *-test.tsx.snap so Jest finds them under the
  new test filenames
- Drop the now-unused @ts-expect-error suppressions on the index/component
  imports in the stories file

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 21, 2026 06:29
@xiaogliu Vincent Liu (xiaogliu) added the minor Non breaking change label May 21, 2026
@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4523 to see this build running in a browser.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@skyscanner-backpack-bot
Copy link
Copy Markdown

Visit https://backpack.github.io/storybook-prs/4523 to see this build running in a browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants