Functional Component has type 'any'
See original GitHub issueEnvironment
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:
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Function Components - React TypeScript Cheatsheets
Easiest way to declare a Function Component; return type is inferred. ... the return type so an error is raised if you accidentally...
Read more >TypeScript with React Functional Components
TypeScript has become a very popular enhancement for JavaScript applications. TypeScript is a superset of JavaScript that forces static ...
Read more >TypeScript and React: Components - fettblog.eu
Functional components are my most favourite thing in React. They are simple, purely functional and super easy to reason about. The following shows...
Read more >How to Develop React Functional Components with TypeScript
4 ways to define React functional components with TypeScript: Using React.FC, JSX.Element, React.PropsWithChildren, & defining the full type directly.
Read more >React 18 TypeScript children FC - Stack Overflow
Type '{ children: ...; }' has no properties in common with type ... Create your custom functional component type (a modification of FC...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe See
If we change
'Functional': typeof import("../components/Functional.ts")['default']
to'Functional': typeof import("../components/Functional")['default']
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.Sure, will do that. Thanks!