Nothing Special   »   [go: up one dir, main page]

Skip to content
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

Enforce stricter scale types #1431

Merged
merged 4 commits into from
May 2, 2023
Merged

Enforce stricter scale types #1431

merged 4 commits into from
May 2, 2023

Conversation

axelboc
Copy link
Contributor
@axelboc axelboc commented May 2, 2023

Multiple components accepting scale types as props (either directly or via an object prop), as well as utility functions and hooks, were wrongly allowed to receive:

  • ScaleType.Gamma without a corresponding exponent
  • ScaleType.Sqrt and ScaleType.Gamma even when those scale types were not meant to be supported

The first issue was due to type VisScaleType incorrectly using Omit instead of Exclude to deal with the special case of ScaleType.Gamma. The second issue was due to props and parameters being typed with ScaleType without consideration for unsupported scales.

I've done a few more refactorings along the way in separate commits, like renaming the confusing AxisScale and createAxisScale to just Scale and createScale, and splitting the H5WEB_SCALES record, which was dealing with totally unrelated responsibilities.

@axelboc axelboc force-pushed the scales branch 3 times, most recently from e4c9a45 to 62f1f16 Compare May 2, 2023 09:10
apps/storybook/src/Toolbar.stories.tsx Show resolved Hide resolved
packages/lib/src/vis/line/utils.ts Show resolved Hide resolved
packages/lib/src/vis/models.ts Show resolved Hide resolved
packages/lib/src/vis/models.ts Show resolved Hide resolved
packages/lib/src/vis/scales.ts Show resolved Hide resolved
packages/lib/src/vis/utils.ts Show resolved Hide resolved
packages/lib/src/vis/utils.ts Show resolved Hide resolved
@axelboc axelboc requested a review from loichuder May 2, 2023 09:11
packages/shared/src/models-vis.ts Outdated Show resolved Hide resolved
packages/lib/src/vis/scales.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants