victorgarciaesgi/nuxt-typed-router

No `class` attribute in `nuxt-link` component

szulcus opened this issue · 4 comments

Type '{ to: "/"; class: string; }' is not assignable to type 'IntrinsicAttributes & Omit<NuxtLinkProps, "to" | "external"> & { to: (Omit<RouteLocationPathRaw | RouteLocationNamedRaw, "name" | "params"> & RoutesNamedLocations) | (Omit<...> & { ...; }) | TypedPathParameter<...>; external?: false | undefined; }'.
  Property 'class' does not exist on type 'IntrinsicAttributes & Omit<NuxtLinkProps, "to" | "external"> & { to: (Omit<RouteLocationPathRaw | RouteLocationNamedRaw, "name" | "params"> & RoutesNamedLocations) | (Omit<...> & { ...; }) | TypedPathParameter<...>; external?: false | undefined; }'.ts(2322)
<nuxt-link to="/" class="class-name">Link</nuxt-link>

image

The problem also occurs without the module, sorry

Sorry again for the confusion. However, I have this module and after removing it, the problem does not occur, so it's a problem with the module after all 😅

Workaround:
In .nuxt/typed-router/typed-router.d.ts:

import type { DefineComponent } from 'vue';
// ...
declare module 'vue' {
  interface GlobalComponents {
    NuxtLink: DefineComponent<TypedNuxtLinkProps>;
  }
}

It's a problem with volar ide, see latest issue or downgrade the extension

Thanks!