For @mdx-js/react, move @types/react from dependencies to peerDependencies
#2238
Unanswered
unrevised6419
asked this question in
General
Replies: 1 comment 32 replies
-
|
Hey!
mdx/packages/react/lib/index.js Line 2 in f4d78be Without it, this project can’t be used in TypeScript. |
Beta Was this translation helpful? Give feedback.
32 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the
@mdx-js/reaactis mentioned this:So it says that the developer itself should install the JSX types he needs,
@types/reactor maybe others like@vue/runtime-domBut there is a problem,
@types/reactis included in packagedependencies, and is creating conflicts with other JSX types, like@vue/runtime-dom, because TypeScript prefers as default@types/react, if it will find it innode_modulesFrom where this discussion was born?
When having a Vue/Nuxt project, it recommends using
Volarextensions that will deal great with TypeScript and adds@vue/runtime-domJSX types by default implicitly.At the moment you want to integrate Storybook, the problem appears, because it will add
@types/reactas a transitive dependency from@mdx-js/reactNow TypeScript will see
@types/reactinnode_modulesand all your JSX in Vue will be Typed as React.The current solution is to do some hacks to stub
@types/reactto an empty packageNow TypeScript will see that there is not JSX namespace in
@types/reactand will go back to using@vue/runtime-domThe suggestion from our side would be to move
@types/reactfromdependenciestodevDependenciesso it wont become a transitive dependency.This was discussed in depth in some threads:
Beta Was this translation helpful? Give feedback.
All reactions