-
Notifications
You must be signed in to change notification settings - Fork 591
Typescript doesn't infer type of component imported from .vue #21
Comments
I've seen the same problem. And the declare below makes all imported component lose the component option type details. All objects are Vue type but actually should be Vue.ComponentOptions declare module "*.vue" { |
Also, is there no way to avoid having to use the Not a huge issue, of course, but nice to have. |
Unfortunately, we can't avoid the Also, you're not going to get a great experience with TypeScript & Vue unless you use We'll try to discuss among the team how to make the SFC experience better. |
The issue with the .vue extension makes working with typescript almost impossible. Even with the example from this repository, and using If I import a non-existing .vue file I get no error:
Not only that. but changing code in a .vue file is not reflected by intellisense in other vue files unless I restart VS Code. This is all caused by the |
I don't know how respond to your question other than by just stating that it's not an easy problem to solve and we have finite resources. This starter provides several different options for organizing your files. If you want, you have your What it comes down to right now is that you can get self-contained internal validation within a component, but you're unfortunately limited in any validation across those components. |
Would there be a way to make this single import statement work without the declaration.d.ts file? index.ts
|
If you guys use vue-template-loader you get type inference back. |
On this import statement:
myComponent has the type of Vue. When I "go to defintion" on this symbol, it goes to Vue type declaration instead of going to myComponent.vue file.
Is there a way to resolve this? I'm trying to switch from ts files to single file components but this seems like a regression compared to working with ts files.
The text was updated successfully, but these errors were encountered: