Skip to content

refactor(components): [mention] use type-based definitions#23440

Merged
btea merged 1 commit into
element-plus:devfrom
E66Crisp:refactor-mention
Jan 18, 2026
Merged

refactor(components): [mention] use type-based definitions#23440
btea merged 1 commit into
element-plus:devfrom
E66Crisp:refactor-mention

Conversation

@E66Crisp
Copy link
Copy Markdown
Contributor

@E66Crisp E66Crisp commented Jan 18, 2026

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

ref #23399

  • 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.

Summary by CodeRabbit

  • Refactor
    • Enhanced Mention and MentionDropdown components with improved TypeScript interfaces for better type safety and developer experience.
    • Introduced new prop interfaces with sensible defaults, replacing legacy type definitions.
    • Marked outdated type exports as deprecated to encourage migration to new API.

✏️ 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

This pull request refactors the Mention component's prop system by replacing runtime prop objects and ExtractPropTypes with explicit TypeScript interfaces. The changes apply the same migration pattern across four files: converting defineProps() calls to defineProps<Interface>() with withDefaults(), introducing new public interfaces, and deprecating old type exports.

Changes

Cohort / File(s) Summary
Dropdown Props Interface
packages/components/mention/src/mention-dropdown.ts
Adds new exported interface MentionDropdownProps with optional fields (options, loading, disabled, contentId, ariaLabel); marks old mentionDropdownProps constant as deprecated
Dropdown Component
packages/components/mention/src/mention-dropdown.vue
Replaces defineProps(mentionDropdownProps) with defineProps<MentionDropdownProps>() and withDefaults(), providing default value for options
Mention Props Interface
packages/components/mention/src/mention.ts
Introduces new MentionProps interface extending InputProps with 14 optional fields; replaces ExtractPropTypes with ExtractPublicPropTypes; deprecates old MentionPropsPublic alias
Mention Component
packages/components/mention/src/mention.vue
Updates imports to include inputPropsDefaults and filterOption; converts to defineProps<MentionProps>() with withDefaults() containing expanded defaults

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Contribution::Community

Suggested reviewers

  • rzzf
  • btea
  • keeplearning66

Poem

🐰 A mention dropdown hops with grace,
Props refined in their new place,
Interfaces typed, defaults so clear,
The old way fades, the new draws near!
With TypeScript's blessing, structured and right,
Our refactor shines ever bright! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description includes the standard checklist template but lacks substantive context about the refactoring objectives, changes made, or reasoning beyond the issue reference. Add a detailed description explaining the refactoring purpose, what was changed in the mention component's type definitions, and why this change improves the codebase.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor(components): [mention] use type-based definitions' clearly and specifically describes the main change: converting the mention component to use type-based prop definitions instead of value-based ones.
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@23440
npm i https://pkg.pr.new/element-plus/element-plus@23440
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 8bf23b0

@btea btea merged commit 99befe0 into element-plus:dev Jan 18, 2026
22 of 23 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@E66Crisp 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