typescriptvue.jsvisual-studio-codeintellisensevetur

VSCode intellisense for Typescript Vue (Auto import at @Component)


I'm currently developing a small project in VSCode with Typescript and Vue. I have VSCode with the following plugins TSLint, TSLint Vue, Vetur and Prettier.

I can not get the intellisense "auto import" part to work whenever i try and refer to a class from the @Component part like this.

@Component({
  components: {
    User //Here it doesn't work
  },
})

Example of the error when trying to auto import

But as you can see here further down in the code it works.

import User from '@/models/user';

@Component({
  components: {
    User //Here it doesn't work
  },
})
export default class Project extends Vue {
  user: User = new User(); //Here i can get the intellisense to auto import "User"
}

Example of the intellisense working fine

Is it because it's shorthanded and therefor can't reference it?


Solution

  • Well i guess i'll just go with the solution without shorthand "User: user"