Skip to content

NuxtLinkLocale wrapper breaks custom prop typing (TS error: Type 'true' is not assignable to type 'false') #3883

@zalment

Description

@zalment

Environment

Operating System: Darwin

  • Node Version: v22.12.0
  • Nuxt Version: 4.0.3
  • CLI Version: 3.28.0
  • Nitro Version: 2.12.5-20250819-230311.89278001
  • Package Manager: [email protected]
    -@nuxtjs/i18n version: 10.2.1

Reproduction

<NuxtLinkLocale to="/about" custom v-slot="{ isActive, navigate }">
       <button @click="navigate" >
          About us
       </button>
</NuxtLinkLocale>

Describe the bug

NuxtLinkLocale wraps NuxtLink but does not preserve the generic on NuxtLinkProps.
Because of this, passing :custom="true" produces a TypeScript error:
Type 'true' is not assignable to type 'false'.

Additional context

A simple fix would be to preserve the generic or use boolean:

type NuxtLinkLocaleProps = Omit<NuxtLinkProps<boolean>, 'to'> & { //added <boolean>
  to?: RouteLocationNamedI18n
  locale?: Locale
}

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions