Skip to content

refactor(components): [timelineItem] use type-based definitions#23479

Merged
btea merged 3 commits into
element-plus:devfrom
cjn021:refactor/timelineitem-type-based
Jan 20, 2026
Merged

refactor(components): [timelineItem] use type-based definitions#23479
btea merged 3 commits into
element-plus:devfrom
cjn021:refactor/timelineitem-type-based

Conversation

@cjn021
Copy link
Copy Markdown
Contributor

@cjn021 cjn021 commented Jan 19, 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.

Summary by CodeRabbit

  • Refactor
    • Improved Timeline item prop handling with stronger typing and introduced default values for key properties — timestamp (empty), placement (bottom), type (empty), color (empty) and size (normal).

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

Warning

Rate limit exceeded

@rzzf has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 39b6e21 and 6fd541a.

📒 Files selected for processing (1)
  • packages/components/timeline/src/timeline-item.ts
📝 Walkthrough

Walkthrough

Replaces the TimelineItem component's runtime prop-object export with an explicit exported TimelineItemProps interface, deprecates the old prop-object/type export, introduces a TimelineItemPropsPublic alias, and updates the Vue component to use typed defineProps<TimelineItemProps>() with defaults.

Changes

Cohort / File(s) Summary
TimelineItem Type Definition
packages/components/timeline/src/timeline-item.ts
Adds exported TimelineItemProps interface (timestamp, hideTimestamp, center, placement, type, color, size, icon, hollow); replaces ExtractPropTypes import with Component, ExtractPublicPropTypes; marks new interface and existing timelineItemProps as deprecated; removes export type TimelineItemProps = ExtractPropTypes<...>; adds export type TimelineItemPropsPublic = ExtractPublicPropTypes<typeof timelineItemProps>.
TimelineItem Component
packages/components/timeline/src/timeline-item.vue
Switches from importing timelineItemProps to import type { TimelineItemProps }; uses defineProps<TimelineItemProps>() with withDefaults to set defaults for timestamp, placement, type, color, and size; removes runtime prop-object import.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Dsaquel
  • btea

Poem

🐰✨ I nibbled through props, neat and spry,
Interfaces planted under the sky,
Defaults like carrots placed just so,
Old types bow out, new types grow,
Hoppity cheers for tidy code! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description contains only the template checklist with no actual content describing the changes, issues addressed, or rationale for the refactoring. Add a description explaining what was refactored, why, and any breaking changes or migration notes. Reference any related issues using GitHub issue syntax (#number).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: refactoring timelineItem component to use type-based definitions instead of prop builders.
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@23479
npm i https://pkg.pr.new/element-plus/element-plus@23479
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 6fd541a

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 19, 2026

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

Comment thread packages/components/timeline/src/timeline-item.vue
@btea btea merged commit 20bc3bc into element-plus:dev Jan 20, 2026
16 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

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