[DEPRECATED] This repo was intended as a staging area for typescript definitions supporting the latest major release of D3js (i.e. version 4.1.x) by Mike Bostock. It has been migrated to DefinitelyTyped.
MIT License
53
stars
14
forks
source link
Chore: Change Return Types to `this` in interfaces which are chainable #66
Previously, I explicitly typed the return type of interface methods which are chainable, rather than returning this.
The step was an interim measure to have clearer visibility to the this type of function contexts. I.e. searchable while refining the approach to the callbacks.
Given the stability of the definitions at this point. Now would be a good time to use this return type, where applicable.
Important: In particular in d3-selection and d3-transition several methods return new selections/transitions. I.e. they are immutable with respect to the selected elements. (Need to review one- by-one to ensure they are not set to this as part of this chore).
Previously, I explicitly typed the return type of interface methods which are chainable, rather than returning
this
.The step was an interim measure to have clearer visibility to the
this
type of function contexts. I.e. searchable while refining the approach to the callbacks.Given the stability of the definitions at this point. Now would be a good time to use
this
return type, where applicable.Important: In particular in
d3-selection
andd3-transition
several methods return new selections/transitions. I.e. they are immutable with respect to the selected elements. (Need to review one- by-one to ensure they are not set tothis
as part of this chore).