Stack Overflow Asked by Berco Beute on February 6, 2021
I’m still lost in Vue (3) + Typescript trying to specify a data property of a certain type. I’ve added a .d.ts
file but to no avail. I’m trying this:
import Modeler from 'bpmn-js/lib/Modeler'
...
data() {
return {
modeler: {} as InstanceType<typeof Modeler> // ?????
},
}
...
methods: {
do() {
this.modeler.importXML(someXML)
},
}
...
This results in:
'get' on proxy: property '$pkg' is a read-only and non-configurable data property on the proxy target but the proxy did not return its actual value (expected '#<Object>' but got '[object Object]')
If I define the Modeler
instance in methods
things work just fine:
methods: {
do() {
const modeler = new Modeler({container: '#modeler'})
modeler.importXML(someXML)
},
}
I’ve declared the module as in bpmnjs.d.ts
:
// bpmnjs.d.ts
declare module 'bpmn-js/lib/Modeler'
Any idea what I’m doing wrong here?
Finally got it working:
data() {
return {
modeler: markRaw({} as InstanceType<typeof Modeler>)
}
}
...
mounted() {
this.modeler = markRaw(new Modeler({container: '#modeler'}))
}
Answered by Berco Beute on February 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP