[Vuejs]-Typescript giving me errors with variables, and is also compiling code that javascript does not know about

1👍

The problem that you’re having is that typescript does not have access to the types for vue. This is because you’re importing it with a script tag (??) which is not the typical way for web development.

You should most likely set yourself up with Webpack and the like, or, if you don’t want to spend time working out how to configure that, use a zero-config tool like Vue CLI.

If you don’t want to do that, you can try using npm install vue inside of the directory of your typescript project, but make sure that it’s the same version of vue that you are importing via your script tag. Good luck!

Leave a comment