bridge icon indicating copy to clipboard operation
bridge copied to clipboard

Typescript recognition of auto-imports fail but code compiles correctly

Open HendrikJan opened this issue 3 years ago • 0 comments

Environment

Nuxt CLI v3.0.0-rc.4 07:25:35 RootDir: /sandbox 07:25:36 Nuxt project info: 07:25:36


  • Operating System: Linux
  • Node Version: v14.18.1
  • Nuxt Version: 2.16.0-27616340.013f051b
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: ssr, modules, i18n, compilerOptions, bridge, serverHandlers, devServerHandlers, buildModules
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: (), @nuxt/[email protected]

Reproduction

  • Open this sandbox: https://codesandbox.io/s/nuxt-bridge-ts-support-fail-ksnuuo?file=/pages/index.vue

  • See that there is a red line below ref() image

  • Hover over the red line and see the text:

`ref' is not defined. (no-undef)eslint
Cannot find name 'ref'.Vetur(2304)
  • See that the page renders with no problems -- auto-import works, but TS inside the editor doesn't know about it.

The same problem happens in VScode with Vetur, or with Tsc

Describe the bug

The typescript validator (Vetur or Tsc) do not recognised auto-imported functions.

  • After running npx nuxi prepare the problem is fixed, BUT
  • After running npm run dev the problem re-appears

Additional context

TS did work correctly before. The red errors appeared after an upgrade, but I cannot remember from which version to which version.

I noticed this:

  • After running npx nuxi prepare, a file /.nuxt/tsconfig.json is created
  • When running npm run dev this file /.nuxt/tsconfig.json disappears

Logs

No response

HendrikJan avatar Jul 13 '22 07:07 HendrikJan