Encountering numerous type errors with d3js when integrating it into Angular (typescript).
svg.call(d3.zoom().on('zoom', () => {
g.attr('transform', d3.events.transform);
}));
Error thrown:
S2345: Argument of type 'ZoomBehavior<Element, unknown>' is not assignable to parameter of type '(selection: Selection<BaseType, unknown, HTMLElement, any>, ...args: any[]) => void'. Incompatible types for parameters 'selection' and 'selection'.
Additionally, encountering an error where d3.events is undefined.
Looking for guidance on resolving these issues? Many code samples are failing due to these type errors, even using @ts-ignore does not help.
UPDATE: Following the migration guide from v5 to v6 resolved the errors in the zoom handler:
const zoom = d3.zoom().on('zoom', ({transform}, d) => {
g.attr('transform', transform);
});
However, the aforementioned type error persists when trying to call it in this manner:
svg.call(zoom)