-
Notifications
You must be signed in to change notification settings - Fork 120
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
refactor: scale improvements #1383
Conversation
d3d94a0
to
2d2142a
Compare
2d2142a
to
6a5a69e
Compare
test this |
1 similar comment
test this |
test this |
test this |
0751744
to
ae9b210
Compare
test this |
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
85cbf96
to
820f3fd
Compare
test this |
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.
Latest code changes LGTM! Great work Robert!!
export type UnboundedDomainWithInterval = DomainBase; | ||
|
||
/** @public */ | ||
export type DomainRange = LowerBoundedDomain | UpperBoundedDomain | CompleteBoundedDomain | UnboundedDomainWithInterval; | ||
/** @public */ | ||
export type YDomainRange = YDomainBase & DomainRange & LogScaleOptions; | ||
|
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 failed to find an simple solution to this in the form of some deep partial keys on the spec factory. I'll keep the PR here for reference. #1399
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.
Great work here Robert, thanks for taking care of this.
I failed miserably the last time I've tried typing the scale, but you did it an awesome job here!
* switch to TS 4.4 and bump other deps * type strength increase via removing many `any` occurrences * domain oriented generic typing for scales * replacement and future prevention of coercive `==` and `!=` ops * refactoring: simplification and shortening of numerous functions, about 300 runtime lines gone * removal of numerous let, if/then, optional parameters etc. BREAKING CHANGE: The public type varieties for domains are discontinued, in favor of retaining the single `DomainRange` export, which now has a mandatory `{min: number, max: number}`. The developer can supply `NaN` where a finite min, max or both aren't defined (ie. in place of former effective `undefined`). In addition, some console.warn punctuations changed Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com> Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
# [37.0.0](v36.0.0...v37.0.0) (2021-10-05) ### Bug Fixes * **debug:** add predictable axis labels sorting order ([#1418](#1418)) ([60fbe7a](60fbe7a)) * **deps:** update dependency @elastic/eui to ^38.1.0 ([#1409](#1409)) ([4ffd018](4ffd018)) * **deps:** update dependency @elastic/eui to ^38.2.0 ([#1416](#1416)) ([34707c3](34707c3)) ### Code Refactoring * cleanup colors ([#1397](#1397)) ([348c061](348c061)) * scale improvements and TS 4.4 ([#1383](#1383)) ([0003bc1](0003bc1)) ### BREAKING CHANGES * `DEFAULT_CHART_MARGINS`, `DEFAULT_GEOMETRY_STYLES`, `DEFAULT_CHART_PADDING` and `DEFAULT_MISSING_COLOR` are no longer exposed as part of the API * The public type varieties for domains are discontinued, in favor of retaining the single `DomainRange` export, which now has a mandatory `{min: number, max: number}`. The developer can supply `NaN` where a finite min, max or both aren't defined (ie. in place of former effective `undefined`). In addition, some console.warn punctuations changed Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com> Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Summary
Switch to TS 4.4; simplifications; type strength increase via lots of
any
replacements. Replacement and future prevention of coercive==
and!=
opsBREAKING CHANGE
The public type variations for domains are discontinued, in favor of retaining the single
DomainRange
export, which however now has a mandatory{min: number, max: number}
. The user can supplyNaN
where a finite min, max or both aren't defined (ie. in place of former omisison orundefined
).Some console.warn punctuations changed.
Details
any
s removed from continuous and band scales; oneany
removed fromScale
. Some of theseany
fixes needed some new type assertions in more specific, localized places (very low count), future PRs can attempt to solve those too with type guards or generics.Note to reviewers:
any
s, and the downstream type assertions necessitated byany
removal, because the numerous preexisting (and still extant)any
s mean that information can't always be learned from other typesany
(eg. inScale
) and theas
assertions, necessitated by the removal of theany
instances are welcome, due to your experience with the Cartesian implementation and use cases within ElasticIssues
Checklist
:xy
,:partition
):interactions
,:axis
)closes #123
,fixes #123
)packages/charts/src/index.ts