'How do i add typescript support to CDN version of vue?

I'm using the cdn version of vue on certain parts of my project. I want typescript support included on these parts of the project that are using vue cdn, but due to the technical stack we can't use Vue CLI. There is any way to import Vue.js into a plain Typescript file? How can I make work Vue.js and typescript without Vue cli?



Solution 1:[1]

Not sure if this solves the original problem but if you're not using Vue CLI (or even npm packages) and are pulling in the Vue library via a CDN, you could try:

const Vue = (window as any).Vue;

at the top of your .ts file instead of an import.

It's a bit hacky since your not getting any typing information for Vue (that said, it's not much of a loss for Vue version 2) but it might get you going.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mrrrk