Closed Evertt closed 7 years ago
Never mind, I rewrote the collectData()
method and now it works. :-)
I think this incompatibility lies in nuxt.js.
Nuxt.js changes the data() {} option in such a way that this is not available anymore.
this
is required in data method because we may need props
to initialize data
. I do think we need to fix in nuxt.js, though I don't know why nuxt does so.
https://nuxtjs.org/guide/async-data
This is documented in nuxt's website. I think you should use @Data
decorator.
I will guard against this naughty behavior.
Warning: incompatible data
option is a pernicious design, use it on your own discretion.
Fixed in 0.6.3
I like Nuxt.js very much and I was wondering if it would be possible to use av-ts in a Nuxt.js project. I've been trying to get it to work, but I get
Cannot convert undefined or null to object
. (unfortunately without a stack trace)edit
Okay I figured out where the error comes from. Nuxt.js changes the
data() {}
option in such a way thatthis
is not available anymore. Which goes wrong in thecollectData()
method of this library, because it doeslet vm = this
and then a bit later onfor (let key of Object.keys(vm)) { ... }
which of course doesn't work ifthis
is undefined.