-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: Relax constraints on @react-spring/web
#2280
Conversation
Having a constraint on `@react-spring/web` blocking it to a very precise version (here: `9.4.5`) can push users of nivo into pulling it several times in their node_modules or bundles if they don't really check for duplicated packages. Indeed it's rather simple to have two distinct libraries requesting it at version `9.x` at the same time, and if one of them (not nivo) request something not being `9.4.5` they we would pull the library twice. It seems that given `@react-spring/web` seems to follow semver, there is not real risk to say nivo supports `^9.4.5` instead of `9.4.5` only.
Seems that I have some pieces of the code to adapt if I want this Pr to make it and at least compile: packages/treemap/src/defaults.ts:69:14 - error TS4023: Exported variable 'htmlDefaultProps' has or is using name 'AnimationConfig' from external module "/tmp/9a4cf066/node_modules/@react-spring/core/dist/index" but cannot be named.
69 export const htmlDefaultProps = { |
Some open-source and largely used libraries such as nivo directly bind to the types being declared by `@react-pring/core` in some of their code. For instance in nivo, the following code: ```ts import { SpringValues } from '@react-spring/web' //... export interface NodeProps<Datum extends object> { //... animatedProps: SpringValues<NodeAnimatedProps> //... } ``` Implicitely force nivo to be able to reference parts of the typings of `@react-spring/core` into their d.ts files if they want to be able to publish their package. It basiaclly results into `Partial<import("@react-spring/core").AnimationConfig>` in the produced d.ts at some point. And as a consequence TypeScript complains with the error `error TS4023: Exported variable 'htmlDefaultProps' has or is using name 'AnimationConfig' from external module "/tmp/9a4cf066/node_modules/@react-spring/core/dist/index" but cannot be named.`. The proposed change exposes `AnimationConfig` as a type, meaning we still don't expose the class, just its type. It would help into making nivo able to support recent version of `@react-spring/*`. See related issue on nivo's side: plouc/nivo#2280
This PR is waiting for a status on pmndrs/react-spring#2128. If the other PR gets merged then nivo could probably start declaring this import with a |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b40fb6f:
|
@plouc Any opinion? |
|
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
Having a constraint on
@react-spring/web
blocking it to a very precise version (here:9.4.5
) can push users of nivo into pulling it several times in their node_modules or bundles if they don't really check for duplicated packages. Indeed it's rather simple to have two distinct libraries requesting it at version9.x
at the same time, and if one of them (not nivo) request something not being9.4.5
they we would pull the library twice.It seems that given
@react-spring/web
seems to follow semver, there is not real risk to say nivo supports^9.4.5
instead of9.4.5
only.