I'm currently struggling with Vue (3) + Typescript while attempting to specify a data property with a specific type. I have created a .d.ts
file, but unfortunately, it hasn't helped. This is what I'm trying:
import Modeler from 'bpmn-js/lib/Modeler'
...
data() {
return {
modeler: {} as InstanceType<typeof Modeler> // ?????
},
}
...
methods: {
do() {
this.modeler.importXML(someXML)
},
}
...
However, when I run this code, I encounter the following error message:
'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]')
Interestingly, if I define the instance of Modeler
within the methods
, everything works as expected:
methods: {
do() {
const modeler = new Modeler({container: '#modeler'})
modeler.importXML(someXML)
},
}
I've already declared the module in my bpmnjs.d.ts
file:
// bpmnjs.d.ts
declare module 'bpmn-js/lib/Modeler'
Any insights into what mistake I might be making here?