Skip to content

refactor(components): [empty] use type-based definitions#23428

Merged
rzzf merged 1 commit into
element-plus:devfrom
lw56777:refactor/empty-ComponentProps-#23399
Jan 18, 2026
Merged

refactor(components): [empty] use type-based definitions#23428
rzzf merged 1 commit into
element-plus:devfrom
lw56777:refactor/empty-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 Empty component with enhanced type safety.
    • Deprecated legacy API exports; migrate to new public type interfaces for continued support.

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

@pull-request-triage
Copy link
Copy Markdown

👋 @lw56777, seems like this is your first time contribution to element-plus.
Please make sure that you have read our guidelines and code of conduct before making a contribution.

@pull-request-triage pull-request-triage Bot added 1st contribution Their very first contribution Needs Review labels Jan 18, 2026
@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 PR refactors the Empty component's prop type system by introducing an explicit EmptyProps interface, replacing ExtractPropTypes-based public exports with ExtractPublicPropTypes, and updating the component to use withDefaults(defineProps<EmptyProps>()) for prop initialization.

Changes

Cohort / File(s) Summary
Type definitions and exports
packages/components/empty/src/empty.ts
Added EmptyProps interface with optional image, imageSize, and description fields. Replaced EmptyProps public type alias with EmptyPropsPublic using ExtractPublicPropTypes. Removed ExtractPropTypes import. Added deprecation comment blocks for legacy usage paths.
Component implementation
packages/components/empty/src/empty.vue
Updated props declaration from defineProps(emptyProps) to withDefaults(defineProps<EmptyProps>(), { image: '', description: '' }). Replaced emptyProps import with EmptyProps type import.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • element-plus/element-plus#23366 — Performs the same refactor replacing ExtractPropTypes with explicit public prop interfaces and type-based defineProps with withDefaults.
  • element-plus/element-plus#23412 — Applies identical pattern: runtime prop objects replaced with explicit exported interfaces and ExtractPublicPropTypes aliases, with type-based defineProps/withDefaults updates.
  • element-plus/element-plus#23400 — Identical refactor: replaces ExtractPropTypes with explicit Props interface plus ExtractPublicPropTypes-based deprecated alias, and updates component props to withDefaults(defineProps<...>()).

Suggested labels

Contribution::Community, Needs Review

Suggested reviewers

  • rzzf
  • keeplearning66
  • btea

Poem

🐰 A hop, a skip, the types align,
From runtime props to interfaces fine,
With EmptyProps and defaults in place,
The component's type system finds its grace! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive PR description includes the submission checklist with all boxes checked and references issue #23399, but lacks substantive details about the refactoring changes. Add detailed description of the refactoring: explain why type-based definitions are being adopted, what benefits they provide, and document the migration path for the deprecated EmptyProps alias.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main refactoring effort: converting the empty component to use type-based prop definitions instead of runtime-based definitions.
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@23428
npm i https://pkg.pr.new/element-plus/element-plus@23428
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 30d7003

@github-actions
Copy link
Copy Markdown
Contributor

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

@rzzf rzzf merged commit ba2b690 into element-plus:dev Jan 18, 2026
25 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@lw56777 Thanks for your contribution! ❤️

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