Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webstorm does not correctly display type of globally injected properties #19399

Closed
ERPedersen opened this issue Mar 2, 2023 · 5 comments · Fixed by #19400
Closed

webstorm does not correctly display type of globally injected properties #19399

ERPedersen opened this issue Mar 2, 2023 · 5 comments · Fixed by #19400

Comments

@ERPedersen
Copy link
Contributor

Environment

  • Operating System: Darwin
  • Node Version: v14.18.1
  • Nuxt Version: 3.2.2
  • Nitro Version: 2.2.2
  • Package Manager: yarn@1.22.17
  • Builder: vite
  • User Config: modules, build, runtimeConfig, vite
  • Runtime Modules: @nuxt/content@2.4.3, @pinia/nuxt@0.4.6, nuxt3-lazy-load@1.0.2
  • Build Modules: -

Reproduction

Documentation issue.

Describe the bug

When injecting helpers into the NuxtApp instance through a plugin, the documentation suggests adding a module declaration for vue.

It seems that this should be changed to @vue/runtime-core for IDEs to correctly detect the type within templates.

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

Would you provide a reproduction? 🙏

@ERPedersen
Copy link
Contributor Author

@danielroe Thanks for responding so quick! 🔥

I have created a CodeSandbox here with a fresh installation of nuxt using npx nuxi init, and included the following files:

  • utils/hello.ts, exports a function hello, which has a function type of HelloFunction.
  • plugins/hello.ts, injects the hello function into the NuxtApp instance.
  • app.vue, uses the hello function in the template.

I have attached a video of the issue, using the same repository as the code sandbox.

Screen.Recording.2023-03-03.at.17.52.39.mov

@danielroe
Copy link
Member

First, you should not need to type this yourself - Nuxt types provided properties automatically. Second, this works fine for me both in the CodeSandbox and locally. I think this is likely a WebStorm bug - it probably needs to be updated to use vue rather than @vue/runtime-dom. Would you be happy to raise an issue in their tracker? 🙏

@danielroe danielroe changed the title Injected helpers not type hinted properly in templates when declared according to docs webstorm does not correctly display type of globally injected properties Mar 4, 2023
@ERPedersen
Copy link
Contributor Author

Yes, I will do that. Automatic types are not working for me either, which is why I did this to start with.

@ERPedersen
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants