JSX element class does not support attributes because it does not have a 'props' property

See original GitHub issue

šŸ› Bug Report

I am getting an error from typescript compiler on every component imported from this library: JSX element class does not support attributes because it does not have a 'props' property To be honest I am not really sure it is not due to the monorepo structure or the tsconfig setup but it is the first time I see this kind of error. The weird thing is, it still compiles while my vscode screen is all red of errors…

I hope someone here has seen this error or knows how to fix it.

To Reproduce

Steps to reproduce the behavior: I am on a somewhat fresh install of react-native inside a monorepo (lerna+yarn workspace). The following snippet gives an error for IconRegistry and ApplicationProvider components.

function App () {
  return (
    <Provider store={store}>
      <IconRegistry icons={[EvaIconsPack, AntIconsPack, FeatherIconsPack, IoniconIconsPack, SimpleLineIconsPack]} />
      <ApplicationProvider
        {...eva}
        theme={{...eva.dark, ...theme}}
        customMapping={mapping}
      >
        <Router />
      </ApplicationProvider>
    </Provider>
  )
}

Expected behavior

I shouldn’t get an error from the compiler.

UI Kitten and Eva version

Package Version
@eva-design/eva ^2.1.1
@ui-kitten/components ^5.1.1

Environment information


Issue Analytics

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

github_iconTop GitHub Comments

12reactions
xydiancommented, May 9, 2022

This issue appears because @types/react-native does have an peer dependency to @types/react of *. Hence two different versions are installed (you can find out by running yarn list @types/react). As far as I understand this should be covered by yarn deduplicate, I don’t know why that is not the case. But you can fix this by specifing the specific version that should be defined by using resolutions in package.json

I just added the following section to package.json and it works now. After that you have to delete node_modules and run yarn install again

"resolutions": { "@types/react": "~17.0.21" },

See this link for more info about resolutions in yarn

3reactions
kingjameseguncommented, Sep 17, 2022

any help here pls?

JSX element class does not support attributes because it does not have a ā€˜props’ property.ts(2607)

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSX element class does not support attributes because it does ...
I get this error when using "Cropper"Ā ...
Read more >
Error "JSX element class does not support attributes because ...
Forum Thread - Error "JSX element class does not support attributes because it does not have a 'props' property" when following the tutorialĀ ......
Read more >
HTML : JSX element class does not support attributes ...
HTML : JSX element class does not support attributes because it does not have a ' props ' property.ts. 889 views 10 months...
Read more >
jsx element class does not support attributes ... - You.com
jsx element class does not support attributes because it does not have a 'props' property. Clear input field icon. Search query.
Read more >
JSX element class does not support attributes because it does ...
Coding example for the question JSX element class does not support attributes because it does not have a 'props' property.ts(2607)-Reactjs.
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