-
Notifications
You must be signed in to change notification settings - Fork 122
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
test(xy): scale type improvements #1381
Changes from 1 commit
543c33c
915c86f
9ed546a
12ef5a8
c7f89b2
26d9935
8675664
2ae39b3
57c5c8f
3607f0a
ae17f5c
bb93b5a
432238d
9be0b6a
770f3a6
44af026
6eea0f7
0ec33ef
7272653
5bc5c0a
3e30380
09bed4a
c20cef9
0ac3fd2
8cd6cda
afaceb6
b59e2e0
b36aefb
640d644
36d1596
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ export function computeRectAnnotationDimensions( | |
let xAndWidth: { x: number; width: number } | null = null; | ||
|
||
if (isBandScale(xScale)) { | ||
xAndWidth = scaleXonBandScale(xScale, x0, x1); | ||
xAndWidth = scaleXonBandScale(xScale as ScaleBand<number>, x0, x1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one also seems unnecessary, see my previous comment in file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thanks for the catch, I need to revisit these (the assertion was done before the function param types were tightened) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
nickofthyme marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else if (isContinuousScale(xScale)) { | ||
xAndWidth = scaleXonContinuousScale(xScale, x0, x1, isHistogram); | ||
} | ||
|
@@ -162,7 +162,7 @@ export function computeRectAnnotationDimensions( | |
} | ||
|
||
function scaleXonBandScale( | ||
xScale: ScaleBand, | ||
xScale: ScaleBand<string | number>, | ||
x0: PrimitiveValue, | ||
x1: PrimitiveValue, | ||
): { x: number; width: number } | null { | ||
|
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 you can remove this assertion because
isBandScale
already define xScale as ScaleBandThere 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.
Thanks, will check! I haven't added assertions where there was no complaint, but it's possible that a later commit made an earlier assertion unnecessary, indeed a good idea to revisit all
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.
Indeed, I only later turned the type guard function generic, now it no longer complains there 👯♀️
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.
0ac3fd2