Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS2339: Property '$cookies' does not exist on type (ambient Typescript declarations not in dist) #5

Open
frankier opened this issue Mar 13, 2018 · 4 comments

Comments

@frankier
Copy link

If you use this in a typescript Vue component, e.g.

this.$cookies.set('foo', resp, {
    secure: true
});

You will get an error like this:

TS2339: Property '$cookies' does not exist on type

The underlying problem is the contents of https://github.com/S64/vue-universal-cookies/blob/master/packages/vue-universal-cookies/typings/vue.d.ts are not included in dist/index.d.ts . I haven't been able to find a way to get these ambient declarations included in index.d.ts.

My current workaround is to write:

import 'vue-universal-cookies/typings/vue'

in my component.

@jjoshi-space
Copy link

Stuck on the same issue. If you do find the solution then please help me out with , on https://stackoverflow.com/questions/52775027/vue-compiler-unable-to-parse-cookies
Thank you :)

@ghost
Copy link

ghost commented Dec 15, 2020

In my nuxt project worked by adding in tsconfig.json
"types": [ ... "cookie-universal-nuxt", ]

@RyaiStudio
Copy link

"types": [ ... "cookie-universal-nuxt", ] adding in tsconfig.json

I just figure something hope this helps

const { $cookiz }:any = this
console.log($cookiz.get('storeAddress'));
const { $cookiz }:any = this.$root.$options
console.log($cookiz.get('storeAddress'));

@OmarAbdo
Copy link

In my nuxt project worked by adding in tsconfig.json "types": [ ... "cookie-universal-nuxt", ]

Exactly what I was looking for, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants