-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TypeScript errors in lib/utils #231
base: ts-fixes
Are you sure you want to change the base?
Conversation
23a250c
to
39e9c1f
Compare
const unpaddable = ['scaleThreshold', 'scaleQuantile', 'scaleQuantize', 'scaleSequentialQuantile']; | ||
|
||
/** | ||
* @typedef {import('d3-scale').ScaleLinear<any, any> | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I went through the d3-docs and added the interface definitions.
Not sure whether one should exclude those that are filtered out with unpaddable
or whether there is already combinations like scaleContinuousNumeric
which would make the list shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, even though the script will handle an unpaddable scale, that it should be a typescript error if you try to pass in an unpaddable scale.
I didn't follow the second part of what you were saying about scaleContinuous Numeric
. Can you explain what you mean more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I should have linked that. in d3-typed there is scaleContinousNumeric, which then gets extended to ScaleLinear
, ScalePower
, ScaleLogarithmic
and a few more.
Thanks for this one. I was away for a few weeks and will go through this. |
I think this is looking really good. I made some changes and added some comments. I still need to go through |
@param {Function} scale A D3 scale funcion | ||
@param {number[]} padding A two-value array of numbers specifying padding in pixels | ||
@param {Scale} scale A D3 scale funcion | ||
@param {[number, number]} padding A two-value array of numbers specifying padding in pixels | ||
@returns {number[]} The padded domain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type is [number, number]
also, right?
This fixes a few more TypeScript errors, those in
lib/utils
(see #218).The error messages were: