question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Types of property 'css' are incompatible. Type 'InterpolationWithTheme<any>' is not assignable to type 'Interpolation<Theme>'

See original GitHub issue

Current behavior:

When using css prop with Next.js, it sometimes yields a warning about Types of property 'css' are incompatible.. (not always)

I’m confused as to why. For now, I’m // @ts-ignore all issues manually.

It happens on both svg elements and css properties.

Error:(51, 6) TS2322: Type '{ accept?: string; acceptCharset?: string; action?: string; allowFullScreen?: boolean; allowTransparency?: boolean; alt?: string; as?: string; async?: boolean; autoComplete?: string; autoFocus?: boolean; ... 356 more ...; flipModeOptions: { ...; }; }' is not assignable to type '{ css?: Interpolation<Theme>; }'.
  Types of property 'css' are incompatible.
    Type 'InterpolationWithTheme<any>' is not assignable to type 'Interpolation<Theme>'.

image

image

To reproduce:

  1. git clone https://github.com/UnlyEd/next-right-now.git at-update-deps-03-31
  2. cd at-update-deps-03-31 && git checkout at-update-deps-03-31
  3. cp .env.local.example .env.local - Uses the default ENV variables when running locally
  4. yarn
  5. yarn start
  6. Open http://localhost:8888

PR: https://github.com/UnlyEd/next-right-now/pull/304

Expected behavior:

It should’t issue an error.

Environment information:

"@emotion/react": "11.1.5",
"@emotion/styled": "11.1.5",
"react": "17.0.2",

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:12
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Andaristcommented, Apr 5, 2021

This sounds like an issue with Storybook (since it’s still on Emotion 10). Not much that we can do about it here.

2reactions
vadisticcommented, Apr 6, 2021

You mean you edit the installed packages within node_modules by hand? That won’t work for me because CI/CD builds won’t do that and it’ll fail during build due to TS error, so my best course of action is still to @ts-ignore those.

Yep, but then you’re creating a (git) patch that is applied there in any next install - eg on CI.

This can be done with patch-package tool:

https://www.npmjs.com/package/patch-package

Or you can use yarn 2 patch protocol(if you’re using it): https://yarnpkg.com/cli/patch https://yarnpkg.com/cli/patch-commit https://yarnpkg.com/features/protocols#patch

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Types of property 'css' are incompatible. ...
Types of property 'css' are incompatible. Type 'InterpolationWithTheme ' is not assignable to type 'Interpolation '
Read more >
Emotion types are polluting the global scope · Issue #1800
Types of property 'css' are incompatible. Type 'string ... Type 'FlattenInterpolation<ThemeProps<any>>' is not assignable to type ...
Read more >
TypeScript issue with styled-component's "css" prop and ...
Type 'readonly SimpleInterpolation[]' is not assignable to type 'ObjectInterpolation<undefined>'. Types of property 'filter' are incompatible.
Read more >
TypeScript
These definitions infer types for css properties with the object syntax, ... css({ ^ Argument of type 'boxSizing: 'bordre-box';' is not assignable [....
Read more >
importing types from @storybook/react breaks emotion css ...
Type '({ size }: any) => SerializedStyles' is not assignable to type ... because you'll get a Types of property 'css' are incompatible....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found