Skip to content

feat(types): export RouterLinkSlotScope type - #2917

Merged
posva merged 2 commits into
vuejs:mainfrom
VividLemon:main
Nov 17, 2026
Merged

posva merged 2 commits into
vuejs:mainfrom
VividLemon:main

Conversation

@VividLemon

@VividLemon VividLemon commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

I would benefit from being able to import this slot scope type

Summary by CodeRabbit

  • New Features
    • Added the RouterLinkSlotScope type to the main and experimental package exports. TypeScript users can use it to describe the scope provided to a RouterLink default slot, including when typing slot callbacks.
    • Exported RouterLinkPropsTyped for use in TypeScript applications.

Expose the type of RouterLink's default slot scope so it can be reused
in custom link components.
@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit b6ad995
🔍 Latest deploy log https://app.netlify.com/projects/vue-router/deploys/6afc1ee4936d8b61b2b902e4

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds the exported RouterLinkSlotScope type, uses it for the default-slot callback parameter, updates the experimental RouterLink type declaration, and exports the slot scope type through the package and experimental entry points.

Changes: RouterLink slot scope type

Layer / File(s) Summary
Define and use the slot scope type
packages/router/src/RouterLink.ts
Defines RouterLinkSlotScope as UnwrapRef<UseLinkReturn<Name>> and uses it as the default-slot callback parameter type. Also exports RouterLinkPropsTyped.
Type the experimental RouterLink
packages/router/src/experimental/RouterLink.ts
Defines a local RouterLinkI interface for the typed constructor, props, default slot, and useLink member. The RouterLink variable uses this interface.
Export the slot scope type
packages/router/src/experimental/RouterLink.ts, packages/router/src/experimental/index.ts, packages/router/src/index.ts
Exports RouterLinkSlotScope from the experimental RouterLink module and re-exports it from the experimental and package entry points.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: posva

Merge Risk: Minimal · up to b6ad9

This change exports a type so consumers can import the RouterLink slot scope. It has no runtime effect, and I found no merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(types): export RouterLinkSlotScope type" matches the main change. The PR exports the RouterLinkSlotScope type from the package entry points (packages/router/src/index.ts and experiment…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(types): export RouterLinkSlotScope type" matches the main change. The PR exports the RouterLinkSlotScope type from the package entry points (packages/router/src/index.ts and experimental/index.ts). It also exports RouterLinkPropsTyped and updates the slot typing in RouterLink.ts and experimental/RouterLink.ts. The PR objectives state the same goal: making RouterLinkSlotScope importable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: vuejs/router
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 2ce1151
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f40de94e-cf0f-445b-b721-01f66cad4179
Commits

Reviewing files that changed from the base of the PR and between c02dbc2 and b6ad995.

Files selected for processing: 2

  • packages/router/src/RouterLink.ts
  • packages/router/src/experimental/RouterLink.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/vue-router@2917
npm i https://pkg.pr.new/vue-router@2917
yarn add https://pkg.pr.new/vue-router@2917.tgz

commit: b6ad995

@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.89%. Comparing base (2ce1151) to head (b6ad995).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2917   +/-   ##
=======================================
  Coverage   91.89%   91.89%           
=======================================
  Files          79       79           
  Lines        6602     6602           
  Branches     2197     2175   -22     
=======================================
  Hits         6067     6067           
  Misses        482      482           
  Partials       53       53           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@posva
posva added this pull request to the merge queue Nov 17, 2026
Merged via the queue into vuejs:main with commit d42f47e Nov 17, 2026
12 checks passed
posva added a commit that referenced this pull request Nov 18, 2026
* feat(types): export RouterLinkSlotScope type

Expose the type of RouterLink's default slot scope so it can be reused
in custom link components.

* refactor: review

---------

Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants