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

Functional Component has type 'any' #14853

Closed
f3oall opened this issue Sep 9, 2022 · 5 comments · Fixed by nuxt/framework#7673
Closed

Functional Component has type 'any' #14853

f3oall opened this issue Sep 9, 2022 · 5 comments · Fixed by nuxt/framework#7673

Comments

@f3oall
Copy link

f3oall commented Sep 9, 2022

Environment

nuxi info

  • Operating System: Linux
  • Node Version: v18.8.0
  • Nuxt Version: 3.0.0-rc.9
  • Nitro Version: 0.5.1
  • Package Manager: npm@8.18.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

VSCode + Volar + TakeOver mode 4.8.2

Reproduction

https://github.com/f3oall/nuxt3-functional-component

Describe the bug

Autoimported Functional Components have type 'any'.

You can see that I explicitly typed component in reproduction. If it's not a bug and I'm doing something wrong, explanation is welcome.

Screenshot:

image (2)

Additional context

No response

Logs

No response

Copy link
Member

Have you tried without Nuxt, or via an explicit import, to see whether this is an issue with Volar?

@f3oall
Copy link
Author

f3oall commented Sep 10, 2022

I tried explicit import and it works as expected.

image

@danielroe
Copy link
Member

It does not seem to work (in template) with explicit import, meaning this is a Volar issue rather than a Nuxt one:

CleanShot 2022-09-12 at 11 06 54

Would you raise an issue there?

@f3oall
Copy link
Author

f3oall commented Sep 19, 2022

Sure, will do that. Thanks!

@xiaoxiangmoe
Copy link

xiaoxiangmoe commented Sep 20, 2022

@danielroe See
image

If we change
'Functional': typeof import("../components/Functional.ts")['default']
to
'Functional': typeof import("../components/Functional")['default']

image

This will works well.


So this is also a bug in nuxt. This will only work if TypeScript support import with .ts file extension name in the future.

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.

3 participants