Skip to content

Conversation

@benjamincanac
Copy link
Member

@benjamincanac benjamincanac commented Nov 19, 2025

πŸ”— Linked issue

Resolves #5490

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 19, 2025

npm i https://pkg.pr.new/@nuxt/ui@5491

commit: 520a7da

@benjamincanac benjamincanac changed the title fix(Link): remove html attributes fix(Link): define NuxtLinkProps instead of importing from #app Nov 19, 2025
@benjamincanac benjamincanac marked this pull request as ready for review November 19, 2025 12:04
trailingSlash?: 'append' | 'remove'
}
export interface LinkProps extends NuxtLinkProps, /** @vue-ignore */ Omit<ButtonHTMLAttributes, 'type' | 'disabled'>, /** @vue-ignore */ Omit<AnchorHTMLAttributes, 'href' | 'target' | 'rel' | 'type'> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activeClass property is missing from the LinkProps interface definition, even though it's used throughout the component code. This will cause TypeScript errors when accessing props.activeClass.

View Details
πŸ“ Patch Details
diff --git a/src/runtime/components/Link.vue b/src/runtime/components/Link.vue
index a07f8f44..ca09cecd 100644
--- a/src/runtime/components/Link.vue
+++ b/src/runtime/components/Link.vue
@@ -78,6 +78,8 @@ export interface LinkProps extends NuxtLinkProps, /** @vue-ignore */ Omit<Button
   exactQuery?: boolean | 'partial'
   /** Will only be active if the current route hash is an exact match. */
   exactHash?: boolean
+  /** The class to apply when the link is active. */
+  activeClass?: string
   /** The class to apply when the link is inactive. */
   inactiveClass?: string
   custom?: boolean
diff --git a/src/runtime/vue/components/Link.vue b/src/runtime/vue/components/Link.vue
index e454893a..9c3d2acf 100644
--- a/src/runtime/vue/components/Link.vue
+++ b/src/runtime/vue/components/Link.vue
@@ -47,6 +47,8 @@ export interface LinkProps extends Partial<Omit<RouterLinkProps, 'custom'>>, /**
   exactQuery?: boolean | 'partial'
   /** Will only be active if the current route hash is an exact match. */
   exactHash?: boolean
+  /** The class to apply when the link is active. */
+  activeClass?: string
   /** The class to apply when the link is inactive. */
   inactiveClass?: string
   custom?: boolean

Analysis

Missing activeClass property in LinkProps interfaces

What fails: TypeScript error TS2551 when accessing props.activeClass in components that use it but don't define it in the interface. The LinkProps interface in src/runtime/components/Link.vue and src/runtime/vue/components/Link.vue was missing the activeClass?: string property despite the code accessing it on lines 126/128 and 165/167 respectively.

How to reproduce:

# Run TypeScript compiler on Link components
npx tsc src/runtime/components/Link.vue --noEmit
npx tsc src/runtime/vue/components/Link.vue --noEmit
# Would show: Property 'activeClass' does not exist on type 'LinkProps'

Result: TypeScript compiler would report errors when accessing props.activeClass on these components, even though the property is used in the template code via reactiveOmit (line 119/71) and in the ui computed property (lines 126/100) and resolveLinkClass function (lines 165/176).

Expected: The LinkProps interface should include activeClass?: string to match the code's usage and be consistent with src/runtime/inertia/components/Link.vue which already has this property defined.

Fix applied: Added activeClass?: string property to the LinkProps interface in both:

  • src/runtime/components/Link.vue (line 82)
  • src/runtime/vue/components/Link.vue (line 51)

This makes all three Link components consistent and resolves the TypeScript type error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activeClass lives inside RouterLinkProps

@benjamincanac benjamincanac changed the title fix(Link): define NuxtLinkProps instead of importing from #app fix(Link): define NuxtLinkProps instead of importing from #app Nov 19, 2025
@benjamincanac benjamincanac merged commit da8daaa into v4 Nov 19, 2025
16 checks passed
@benjamincanac benjamincanac deleted the pr/5490 branch November 19, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to resolve extends base type

2 participants