I'm struggling to implement a D3 graph example in my Angular 2 TypeScript application. The issue arises with the lines marked with "----> Error".
I have no clue on how to tackle this problem. Can anyone offer some assistance?
d3.transition().duration(d3.event.altKey ? 7500 : 750).each(function () {
path.exit().transition()
.style("fill-opacity", function (d) {
return d.depth === 1 + (root === p) ? 1 : 0; //----> Error: Operator '+' cannot be applied to types '1' and 'boolean'.
})
.attrTween("d", function (d) {
return arcTween.call(this, exitArc(d));
})
.remove();
path.enter().append("path")
.style("fill-opacity", function (d) {
return d.depth === 2 - (root === p) ? 1 : 0; //----> Error: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
})
.style("fill", function (d) {
return d.fill;
})
.on("click", zoomIn)
.on("mouseover", mouseOverArc)
.on("mousemove", mouseMoveArc)
.on("mouseout", mouseOutArc)
.each(function (d) {
this._current = enterArc(d);
});
path.transition()
.style("fill-opacity", 1)
.attrTween("d", function (d) {
return arcTween.call(this, updateArc(d));
});
});