I'm trying to use Function.prototype.call() to pass an object to my existing function, but Typescript complains about this.
class Hub {
private parseXMLError(xmlString: string) {
xml2js.parseString(xmlString, (err, result) => {
this = {
code: result.code,
message: result.error_message
}
})
}
}
I call the method as such:
async getProcs() {
let errObj = {};
this.parseXMLerror.call(errObj, xmlString);
}
I can use this approach just fine in JavaScript.