-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Missing "@types/react" dependency #17121
Comments
Interesting, I see that it's the approach used by Apollo but that Antd uses the same approach as us. I think that we should pick a tradeoff that best serves npm and yarn users, rush / pnpm have a marginal user base. We can better support them at the condition it doesn't harm the majority. |
Declaration files are the same code modules as anything else and if you use some third-party types in them and expose them in your own types then those types must be specified as dependencies for your package. It is as simple as that. The way it works in There are no multiple ways to handle this, there is only a one way, correct way — explicitly specify all the dependencies in the manifest.
And there is no harm in explicitly specifying the dependencies, it won't break anything :) |
@slavafomin Maybe we would have these two packages as dependencies like we do with
I wouldn't say a coincidence, I believe it was taken into account in the current tradeoff. We don't use a peer dependency which avoids a spoil of the console for JavaScript users and we don't explicit the dependency version to avoid duplication or mismatch of versions of the definitions. But maybe there is a better approach, I don't know. |
In whatever way we depend on |
This is where I'll put together a PR that we'll merge once npm 6.11 is bundled with node. Basically once nodejs/node#29273 is released to node LTS (10). |
Hello!
Thank you for this great library!
You are referencing
react
in public type declarations of your components, however, the@types/react
dependency is missing from the manifest of the@material-ui/core
package.This leads to type-checking errors, because the types for
react
package couldn't be resolved from your declarations:This happens in projects, which use more strict dependency management tools, like
rush / pnpm
, because they block access to implicit dependencies (like in your case).In order to fix this, I would suggest to add
@types/react
and@types/react-dom
packages to thepeerDependencies
section of the@material-ui/core
package manifest.Thanks!
The text was updated successfully, but these errors were encountered: