-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
React Element and ElementClass Declaration Issue #20350
Comments
I have just hit this issue. |
@MortenHoustonLudvigsen is right. Deleting the nested react types from all react-related packages seems to have done the trick. |
Didn't we have a better solution? |
I have the same issue. Does that mean we cannot use yarn with react and TS without ugly hacks? |
The yarn locking algorithm sometimes resolves your packages with duplicates. Actions you need to take:
Actions the community may take:
|
* Yarn removed from the list as npm now does project lock files, and yarn was causing weirdness when upgrading react types (see DefinitelyTyped/DefinitelyTyped#20350) * Updated copyright notice
I have the same issue, but I'm not using yarn. I wiped |
I found this tweet by @basarat 🌹. It helped me figure out that the version of react-datetime I was using had @types/react as a hard dep which was causing the issue. I updated react-datetime to the latest version which included this fix. No more errors! |
Removing |
I resolved this without removing
|
To elaborate on inversions comment for how to work-around this issue, yarn's page on selective dependency resolution says:
When I searched my
Note how the latter allows versions of react outside of 15 (
I then deleted my node_modules and re-installed to convince myself it all worked, and it does. I probably could have been more specific in the resolutions and said: |
Just to confirm that resolutions in package.json does the trick. Anything else failed for both yarn and npm. |
Are we saying npm should be the tool now to use with TS and react? |
I have the same problem and found that react and react-dom in my project is old 15 version. After I updated them to 16, this problem is gone |
to avoid Yarn's duplicate type packages problem: DefinitelyTyped/DefinitelyTyped#20350 (comment)
Adding in package.json
helped me solve this problem |
@types/react
package and had problems.Definitions by:
inindex.d.ts
) so they can respond.The text was updated successfully, but these errors were encountered: