0๐
โ
You could try this patch of a solution: in add-chart.ts
instead of
return new Chart(node, {
.....
});
use
const chart = new Chart(node, {
.....
});
chart.destroy = chart.destroy.bind(chart);
return chart;
A more svelte-idiomatic way might be
return {
...chart,
destroy(){
chart.destroy();
}
}
but that would probably need some typescript acrobatics to pass type-checking.
Source:stackexchange.com