Skip to content

Nuxt Typescript Error #948

@kylegl

Description

@kylegl

Describe the bug

I am using vue-macros with Nuxt 3 via the @vue-macros/nuxt module. While the macros (specifically tested defineModels) function correctly at runtime (the application runs fine in the browser after pnpm dev), TypeScript within my IDE (VS Code with Volar) is not recognizing the globally available macro functions or related types.

  "dependencies": {
    "@vue-macros/nuxt": "3.0.0-beta.10",
    "@vueuse/core": "^13.1.0",
    "@vueuse/nuxt": "^13.1.0",
    "nuxt": "^3.16.2"
  },
export default defineNuxtConfig({
  compatibilityDate: '2024-11-01',
  devtools: { enabled: true },
  modules: ['@vue-macros/nuxt', '@vueuse/nuxt'],
  macros: {
    betterDefine: false,
    defineModels: true,
  },
})

Reproduction

https://stackblitz.com/~/github.com/kylegl/nuxt-tester

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 8.09 GB / 15.59 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.9.0 - ~/.nvm/versions/node/v22.14.0/bin/pnpm
    bun: 1.1.10 - ~/.bun/bin/bun
  Browsers:
    Chrome: 113.0.5672.126

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions