Closed zbjornson closed 8 years ago
I'll have to look at it again tomorrow, I thought I saw something in the source code, where the key function was invoked in two different spots with slightly different arguments.
Ah you're right, my bad.
This key function is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The key function is then also evaluated for each new datum in data, being passed the current datum (d), the current index (i), and the group’s new data, with this as the group’s parent DOM element.
In this:
d
is inferred as{} | number
, which I think is an unnecessary ambiguity.Changing this:
to this:
resolves the ambiguity, but I'm not sure if there's a use case I'm missing where the original Datum and not the NewDatum would be passed to the key fn.