TS error on Nuxt
cpotey opened this issue · comments
Connor Pote commented
Hi! I'm having an issue with using the plugin with Nuxt, it seems to work on the front-end (and is fantastic ❤️), but it's throwing Typescript errors in my VS Code console, so I can't build. I didn't know if this might be an issue with my setup, or something in the package?
ERROR in plugins/vue-frag.ts:6:29
TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'FragmentComponent' is not assignable to parameter of type 'ComponentOptions<Vue, DefaultData<Vue>, DefaultMethods<Vue>, DefaultComputed, PropsDefinition<DefaultProps>, DefaultProps>'.
Types of property 'beforeRouteEnter' are incompatible.
Type 'NavigationGuard<never> | undefined' is not assignable to type 'NavigationGuard<Vue> | undefined'.
Type 'NavigationGuard<never>' is not assignable to type 'NavigationGuard<Vue>'.
Type 'Vue' is not assignable to type 'never'.
4 |
5 | const myPlugin: Plugin = () => {
> 6 | Vue.component('Fragment', Fragment)
| ^^^^^^^^
7 | }
8 |
9 | export default myPlugin
Setup
nuxt.config.js
plugins: [
'~/plugins/vue-frag',
],
vue-frag.ts
import Vue from 'vue'
import { Fragment } from 'vue-frag'
import { Plugin } from '@nuxt/types'
const myPlugin: Plugin = () => {
Vue.component('Fragment', Fragment)
}
export default myPlugin
Hiroki Osame commented
Thanks for the report.
Feel free to open a PR correcting the types.