Skip to content

refactor(components): [transfer] use type-based definitions#23460

Merged
btea merged 5 commits into
element-plus:devfrom
wjp980108:refactor/transfer-type
Jan 20, 2026
Merged

refactor(components): [transfer] use type-based definitions#23460
btea merged 5 commits into
element-plus:devfrom
wjp980108:refactor/transfer-type

Conversation

@wjp980108
Copy link
Copy Markdown
Contributor

@wjp980108 wjp980108 commented Jan 19, 2026

Please make sure these boxes are checked before submitting your PR, thank you!
rel #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

    • Added explicit public prop interfaces for Transfer and marked older prop aliases as deprecated.
    • Tightened prop typings across transfer utilities, requiring specific prop subsets for stronger compile-time checks.
  • Chores

    • Components now supply explicit default values for nested props and stabilize initialization without runtime behavior changes.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 19, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

Replaced runtime ExtractPropTypes-based prop exports with explicit TypeScript interfaces for Transfer and TransferPanel; tightened composable function parameter types to require specific prop subsets; migrated components to type-based defineProps<...>() with withDefaults and nested defaults; marked legacy runtime prop objects as deprecated.

Changes

Cohort / File(s) Summary
Composables — stricter prop signatures
packages/components/transfer/src/composables/use-check.ts, packages/components/transfer/src/composables/use-computed-data.ts, packages/components/transfer/src/composables/use-move.ts
Narrowed exported function parameter types to required/omitted subsets of the new TransferProps (e.g., Required<Pick<...>>, Required<Omit<...>>); only TypeScript signatures changed.
Composables — props alias surface
packages/components/transfer/src/composables/use-props-alias.ts
Parameter type changed from { props: TransferPropsAlias } to accept TransferProps directly; internal initialization still uses Required<TransferPropsAlias> and merging behavior unchanged.
Transfer panel types & runtime props
packages/components/transfer/src/transfer-panel.ts
Added exported TransferPanelProps interface describing panel public shape; retained transferPanelProps runtime definition but annotated it as deprecated; exported TransferPanelPropsPublic remains with deprecation note.
Transfer panel component props usage
packages/components/transfer/src/transfer-panel.vue
Switched from defineProps(transferPanelProps) to defineProps<TransferPanelProps>() wrapped with withDefaults(); removed transferPanelProps import and provided nested defaults via mutable.
Transfer component types & runtime props
packages/components/transfer/src/transfer.ts
Introduced exported TransferProps interface for public API; marked the existing transferProps and ExtractPropTypes-based alias as deprecated and exposed a deprecated TransferPropsPublic alias.
Transfer component props usage
packages/components/transfer/src/transfer.vue
Replaced defineProps(transferProps) with withDefaults(defineProps<TransferProps>(), {...}); added explicit defaults including nested props via mutable and removed reliance on transferProps import.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • btea

Poem

🐇 I nudge the props, make types align,
I tuck in defaults, one small design,
Deprecation carrots in a row,
I hop through code where type winds blow,
A tiny rabbit, tidy and fine.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main refactor: moving Transfer component from runtime prop definitions to type-based definitions.
Description check ✅ Passed The PR description references the related issue (#23399) and confirms all three checklist items were completed, meeting template requirements.
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.


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 19, 2026

Open in StackBlitz

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

commit: 68c2937

@wjp980108
Copy link
Copy Markdown
Contributor Author

CI is having problems again. Will it retry on its own, or do I need to contact management for assistance? @rzzf

@btea
Copy link
Copy Markdown
Member

btea commented Jan 19, 2026

It's okay, don't worry about it, this has nothing to do with the changes you made to the code.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 19, 2026

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

Comment thread packages/components/transfer/src/transfer.vue Outdated
Comment thread packages/components/transfer/src/transfer.vue Outdated
@btea btea merged commit 27eb9ea into element-plus:dev Jan 20, 2026
17 of 20 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@wjp980108 Thanks for your contribution! ❤️

@wjp980108 wjp980108 deleted the refactor/transfer-type branch January 20, 2026 07:24
lw56777 pushed a commit to lw56777/element-plus that referenced this pull request Jan 27, 2026
…plus#23460)

* refactor(components): [transfer] use type-based definitions

* fix: update

* fix: ts

* fix: update

* refactor: tweaks

---------

Co-authored-by: btea <[email protected]>
Co-authored-by: rzzf <[email protected]>
@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