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

CSSInterpolation Type is Incompatible with CSS Prop #3145

Closed
mmarcuccio opened this issue Jan 2, 2024 · 3 comments · Fixed by #3164
Closed

CSSInterpolation Type is Incompatible with CSS Prop #3145

mmarcuccio opened this issue Jan 2, 2024 · 3 comments · Fixed by #3164

Comments

@mmarcuccio
Copy link

Current behavior:

An object of type CSSInterpolation can no longer be passed as the css prop. This was not the case prior to @emotion/serialize@1.1.3.

This is likely due to this recent change #3141

This can be resolved by also changing ArrayInterpolation from Array<Interpolation<Props>> to ReadonlyArray<Interpolation<Props>> {}. However, I am unsure if this would cause other issues (I only tested using @emotion/react via CSS prop).

To reproduce:
Visit the repro below and hover over the CSS prop to see the following error:

Type 'CSSInterpolation' is not assignable to type 'Interpolation<Theme>'.
  Type 'ArrayCSSInterpolation' is not assignable to type 'Interpolation<Theme>'.
    Type 'readonly CSSInterpolation[]' is missing the following properties from type 'ArrayInterpolation<Theme>': pop, push, reverse, shift, and 6 more.

Repro of issue

Expected behavior:

This should not cause a TS issue.

Environment information:

  • react version: 18.2.0
  • @emotion/react version: 11.11.3
@mmarcuccio
Copy link
Author

Sorry, an integration automatically closed this issue on my behalf. @Cerber-Ursi do you happen to have time to investigate? You might have the most context.

@Cerber-Ursi
Copy link
Contributor

Thanks for the ping, will look into it in a couple of days, probably today.

@Cerber-Ursi
Copy link
Contributor

Sorry for the delay - wasn't able to properly setup working environment and was bitten a little by the dependencies (versions in yarn.lock don't work with Node 20, so I had to tinker with them for a while before it built). Patch is on its way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants