Skip to content

refactor(components): [rate] use type-based definitions#23439

Merged
btea merged 2 commits into
element-plus:devfrom
lw56777:refactor/rate-ComponentProps-#23399
Jan 18, 2026
Merged

refactor(components): [rate] use type-based definitions#23439
btea merged 2 commits into
element-plus:devfrom
lw56777:refactor/rate-ComponentProps-#23399

Conversation

@lw56777
Copy link
Copy Markdown
Contributor

@lw56777 lw56777 commented Jan 18, 2026

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

修复:#23399

Summary by CodeRabbit

  • Refactor
    • Improved TypeScript type definitions for the Rate component with enhanced prop documentation and type safety.
    • Updated component prop declarations to better integrate with the type system while maintaining full backward compatibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 18, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

The Rate component's prop definitions are refactored to use explicit TypeScript interfaces instead of dynamic prop extraction, introducing ComponentSize type integration and centralizing default values through typed defineProps with withDefaults.

Changes

Cohort / File(s) Summary
Type Definition Refactoring
packages/components/rate/src/rate.ts
Added RateProps interface defining all component props, integrated ComponentSize type, introduced RatePropsPublic alias based on ExtractPublicPropTypes, and replaced old RateProps type alias with deprecation guidance.
Component Implementation Update
packages/components/rate/src/rate.vue
Switched from defineProps(rateProps) to typed defineProps<RateProps>() wrapped with withDefaults, added imports for RateProps type and Star/StarFilled icons, centralized default prop values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • btea
  • keeplearning66

Poem

🐰 A rate component refined so fair,
With types explicit, props laid bare,
Default values grouped with care,
Interface magic fills the air! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: refactoring the Rate component to use type-based definitions instead of runtime prop definitions.
Description check ✅ Passed The PR description follows the required template with all checkboxes marked complete and includes a reference to issue #23399, though it lacks additional technical details about the refactoring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 18, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus/element-plus@23439
npm i https://pkg.pr.new/element-plus/element-plus@23439
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 813f538

@rzzf
Copy link
Copy Markdown
Member

rzzf commented Jan 18, 2026

@lw56777 Please focus on your previous PR first. CodeRabbit is currently having trouble keeping up with your requests. 😅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 18, 2026

🧪 Playground Preview: https://element-plus.run/?pr=23439
Please comment the example via this playground if needed.

@lw56777
Copy link
Copy Markdown
Contributor Author

lw56777 commented Jan 18, 2026

@lw56777 Please focus on your previous PR first. CodeRabbit is currently having trouble keeping up with your requests. 😅

yeah!Yeah, it's being processed. Sorry, sorry.😅

@btea btea merged commit e71993c into element-plus:dev Jan 18, 2026
17 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@lw56777 Thanks for your contribution! ❤️

@lw56777 lw56777 deleted the refactor/rate-ComponentProps-#23399 branch January 18, 2026 09:46
@element-bot element-bot mentioned this pull request Jan 30, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants