-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Typescript] Type inference fails when useTransition styles are set via functions #1483
Comments
Your example is very noisy, firstly have you checked the docs for transition? I know there were huge changes from rc3 to stable. Secondly, can you reduce your sandbox down to the essence of the bug please? |
Hi @joshuaellis, I tried to reproduce the issue by modifying the official example, and found that if I am not using CSS attributes as the return value such as https://codesandbox.io/s/react-spring-transition-example-q649f?file=/src/App.tsx Is this the intended change to restrict the use of none CSS attributes after the upgrade to the v9 official release? |
No, i don't think it's because they're a CSS value, i think it's because you're using a function to set the vals. So if you just do: enter: { xy: 0, ty: 100 } It will know the types exist, but it clearly doesn't if they're the ReturnValue of a function. If you're interested in solving the issue – that's it. |
i've released a beta |
Hi @joshuaellis, |
🐛 Bug Report
I was trying to make an animated tree diagram using SVG and visx by modifying the example.
👉 Link to Codesandbox: https://codesandbox.io/s/tree-diagram-visx-t3q2d?file=/src/AnimatedLines.tsx
In
9.0.0-rc.3
the type inference ofuseTransition
worked pretty well, thestyles
can be properly inferred as:However, after upgrading to the newer version of react-spring, the
styles
is inferred as{}
.Does anyone have an idea about the cause of this problem?
To Reproduce
Steps to reproduce the behavior:
Open
AnimatedLines.tsx
: https://codesandbox.io/s/tree-diagram-visx-t3q2d?file=/src/AnimatedLines.tsxIn line 44, there are Typescript errors because the styles cannot be properly inferred.
While downgrading to
9.0.0-rc.3
solve this issue.Expected behavior
In
9.0.0-rc.3
transition
is inferred correctly:After the upgrade,
transition
is inferred asTransitionFn<HierarchyPointLink<T>, {}>
.Link to repro (highly encouraged)
https://codesandbox.io/s/tree-diagram-visx-t3q2d?file=/src/AnimatedLines.tsx
Environment
react-spring
v9.1.2react
v17.0.1The text was updated successfully, but these errors were encountered: