fix(nuxt): add back fallback nuxtlink type signature

This commit is contained in:
Daniel Roe 2025-03-02 20:02:12 +00:00
parent 39c2b0a2c4
commit a8856de591
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
2 changed files with 5 additions and 2 deletions

View File

@ -497,11 +497,11 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
}
},
// }) as unknown as DefineComponent<NuxtLinkProps, object, object, ComputedOptions, MethodOptions, object, object, EmitsOptions, string, object, NuxtLinkProps, object, SlotsType<NuxtLinkSlots>>
}) as unknown as new<CustomProp extends boolean = false>(props: NuxtLinkProps<CustomProp>) => InstanceType<DefineSetupFnComponent<
}) as unknown as (new<CustomProp extends boolean = false>(props: NuxtLinkProps<CustomProp>) => InstanceType<DefineSetupFnComponent<
NuxtLinkProps<CustomProp>,
[],
SlotsType<NuxtLinkSlots<CustomProp>>
>>
>>) & Record<string, any>
}
export default defineNuxtLink(nuxtLinkDefaults)

View File

@ -255,6 +255,9 @@ describe('typed router integration', () => {
// @ts-expect-error this is an invalid param
h(NuxtLink, { to: { name: 'param-id', params: { bob: 23 } } })
h(NuxtLink, { to: { name: 'param-id', params: { id: 4 } } })
// doesn't throw an error when accessing properties of component
const _props = NuxtLink.props
})
})