Reputation: 1005
I am using @types/d3-tip with d3 as follows:
self.tooltip = d3.tip()
.attr('class', 'tooltip')
.offset([-10,0])
.html(function(d: Datapoint) {
...
})
self.svg.call(self.tooltip)
This throws up an error:
error TS2345: Argument of type 'Tooltip' is not assignable to parameter of type '(sel: Selection<SVGElement>, ...args: any[]) => any'.
Type 'Tooltip' provides no match for the signature '(sel: Selection<SVGElement>, ...args: any[]): any'
What am I doing wrong?
Upvotes: 2
Views: 311
Reputation: 601
Try using the as
keyword to overcome the type-checker error like this:
self.svg.call(self.tooltip as any)
This approach may be controversial based on this discussion but it will allow you to overcome the error.
Upvotes: 1