Skip to content

Nuxt module breaks type generation #471

@francislg2

Description

@francislg2

The current plugin syntax breaks the type generation of Nuxt. Meaning it break the type inference of all subsequent plugins.

The code should be refactored from:

// old syntax

import vuePlugin from 'lenis/vue'
// @ts-expect-error - nuxt weird static types man
import { defineNuxtPlugin } from '#imports'

const plugin = defineNuxtPlugin({
  name: 'lenis',
  setup(nuxtApp: any) {
    nuxtApp.vueApp.use(vuePlugin)
  },
})

export default plugin

to

// current syntax

import vuePlugin from 'lenis/vue'
// @ts-expect-error - nuxt weird static types man
import { defineNuxtPlugin } from '#imports'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(vuePlugin)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions