Closed faisalhakim47 closed 8 years ago
Do you have typings setup?
make sure to install typings and the vue type definititons like so:
$npm install --save-dev typings
$typings install --save --global dt~vue
In addition, in your ts config:
if using exclude, dont exclude your typings if using include, make sure to include typings/index.d.ts
Closing this for now, let me know if you have any additional issues
it does work after I added vuejs typings globally. Is that how it supposed to work?
yes exactly, normally you would search before installing though ;)
vue, vue-router, and vue-resource (not up to date unfourtunately, you need to add the json() function manually after you install it) all have typings on definitley typed. And i think vuex has typing in the repo. Check out the great seed project by @danielschmitz here for vuex and more: https://github.com/danielschmitz/awesome-vue-typescript
I also made a barebones/minimal typing for vuestrap here: https://github.com/itsFrank/vue-typescript/issues/9
for other vue plugins you can make your own quick typings for the functions you use, or else just cast them as (<any>$('#my-element')).select2();
so that the ts compiler wouldn't complain.
for vue-resource just add a file called 'index.d.ts' to a folder called 'typings_manual/vue-resource' in your project root containing this:
declare namespace vuejs {
interface HttpResponse {
blob():Blob,
json():any,
text():string
}
}
I'll probably be making a pull request on the repo soon though
Ive submitted a pr to dt for vue-resource: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/10349 hopefully it gets merged soon
am I doing something wrong?
this is my tsconfig.json