-
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
chore: tighter partition types #560
Conversation
Codecov Report
@@ Coverage Diff @@
## master #560 +/- ##
==========================================
+ Coverage 71.83% 72.02% +0.19%
==========================================
Files 201 212 +11
Lines 6042 6187 +145
Branches 1170 1188 +18
==========================================
+ Hits 4340 4456 +116
- Misses 1684 1712 +28
- Partials 18 19 +1
Continue to review full report at Codecov.
|
f9f2b99
to
8c32e44
Compare
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.
LGTM, Are we going to do the ValueAccessor
changes we discussed another time?
like allowing an object with fieldName
.
expect(datum!.y1).toBe(1); | ||
expect(datum!.y0).toBe(2); | ||
datum = cleanDatum([0, '1', 2], 0, 1, 2); | ||
expect(datum.y1).toBe(1); | ||
expect(datum.y0).toBe(2); | ||
expect(datum).toBeDefined(); | ||
expect(datum!.y1).toBe(1); | ||
expect(datum!.y0).toBe(2); | ||
|
||
datum = cleanDatum([0, '1', '2'], 0, 1, 2); | ||
expect(datum.y1).toBe(1); | ||
expect(datum.y0).toBe(2); | ||
expect(datum).toBeDefined(); | ||
expect(datum!.y1).toBe(1); | ||
expect(datum!.y0).toBe(2); | ||
|
||
datum = cleanDatum([0, 1, '2'], 0, 1, 2); | ||
expect(datum.y1).toBe(1); | ||
expect(datum.y0).toBe(2); | ||
expect(datum).toBeDefined(); | ||
expect(datum!.y1).toBe(1); | ||
expect(datum!.y0).toBe(2); | ||
|
||
datum = cleanDatum([0, 'invalid', 'invalid'], 0, 1, 2); | ||
expect(datum.y1).toBe(null); | ||
expect(datum.y0).toBe(null); | ||
expect(datum).toBeDefined(); | ||
expect(datum!.y1).toBe(null); | ||
expect(datum!.y0).toBe(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.
Using a ?
would be the same here. I don't like !
expect(datum?.y1).toBe(1);
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.
Sure, let me change that
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.
done here e58c787
Tightens up partitioning chart types. BREAKING CHANGES: The `valueFormatter` prop function now receive only a `number` instead of `any`. In the layers props the `nodeLabel` is now typed as `(d: PrimitiveValue) => String(d)` where `PrimitiveValue` is `string | number | null`. The `fillColor` of a `shape` has a tighter type: `(d: ShapeTreeNode, index: number, array: HierarchyOfArrays) => string` Co-authored-by: Marco Vettorello <[email protected]>
Summary
Tightens up partitioning chart types, as several was, in effect,
any
. See point 3 in #518 (comment)It's a breaking change as it may need that client libraries update types, even though there's no runtime change.
BREAKING CHANGES:
The
valueFormatter
prop function now receive only anumber
instead ofany
.In the
layers
props:nodeLabel
is now typed as(d: PrimitiveValue) => String(d),
wherePrimitiveValue
isstring | number | null
.fillColor
of ashape
has a tighter type:(d: ShapeTreeNode, index: number, array: HierarchyOfArrays) => string;
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.Any consumer-facing exports were added tosrc/index.ts
(and stories only import from../src
except for test data & storybook)Unit tests were updated or added to match the most common scenarios