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

backwards generic params compatibility #2933

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

nlkluth
Copy link
Member

@nlkluth nlkluth commented Oct 28, 2024

Description

Updated types to allow for either prop types in generic or the ContainerType to be inferred. This helps types remain backwards compatible with older types https://github.com/eatyourpeas/victory/blob/9a20d57c111023867bbdf1a9f3b4835acd76f4d3/packages/victory-create-container/src/index.d.ts#L4

NOTE This isn't type safe. You can do

const VictoryZoomVoronoiContainer = createContainer<VictoryZoomContainerProps, VictoryBrushContainerProps>(
  'zoom',
  'voronoi',
);

and it won't complain. This was true in the older versions too since it was attempting to type JavaScript. Inferring the types is definitely the better option. To the point where I am curious on if we should allow this behavior 🤨

Fixes # #2815

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested locally with old version

const VictoryZoomVoronoiContainer = createContainer<VictoryZoomContainerProps, VictoryVoronoiContainerProps>(
    'zoom',
    'voronoi',
);

And new version

const VictoryZoomVoronoiContainer = createContainer(
    'zoom',
    'voronoi',
);

Also, you can do this too, this is what is inferred with new version

const VictoryZoomVoronoiContainer = createContainer<'zoom', 'voronoi'>(
    'zoom',
    'voronoi',
);

Checklist: (Feel free to delete this section upon completion)

  • I have included a changeset if this change will require a version change to one of the packages.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have run all builds, tests, and linting and all checks pass
  • I have added tests that prove my fix is effective or that my feature works
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link

changeset-bot bot commented Oct 28, 2024

🦋 Changeset detected

Latest commit: 59ef5ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 32 packages
Name Type
victory-create-container Patch
victory Patch
rn-demo Patch
victory-area Patch
victory-axis Patch
victory-bar Patch
victory-box-plot Patch
victory-brush-container Patch
victory-brush-line Patch
victory-candlestick Patch
victory-canvas Patch
victory-chart Patch
victory-core Patch
victory-cursor-container Patch
victory-errorbar Patch
victory-group Patch
victory-histogram Patch
victory-legend Patch
victory-line Patch
victory-native Patch
victory-pie Patch
victory-polar-axis Patch
victory-scatter Patch
victory-selection-container Patch
victory-shared-events Patch
victory-stack Patch
victory-tooltip Patch
victory-vendor Patch
victory-voronoi-container Patch
victory-voronoi Patch
victory-zoom-container Patch
victory-docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
victory ⬜️ Ignored (Inspect) Oct 28, 2024 5:05pm

@nlkluth nlkluth marked this pull request as ready for review October 29, 2024 22:21
@nlkluth nlkluth requested a review from carbonrobot October 30, 2024 15:32
@nlkluth nlkluth merged commit 4a38992 into main Oct 30, 2024
7 checks passed
@nlkluth nlkluth deleted the backwards-type-compatibility-create-container branch October 30, 2024 18:44
@github-actions github-actions bot mentioned this pull request Oct 30, 2024
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