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
Fix the JSX runtime types in RunOptions #2465
base: main
Are you sure you want to change the base?
Conversation
`@types/react` now has types for `react/jsx-runtime` and `react/jsx-dev-runtime`. These types are not compatible with the types provided by `hast-util-to-jsx-runtime`, which are used by MDX. To resolve the issue, all runtime related options have been changed to `unknown`. Since the user is supposed to pass in whatever JSX runtime they imported, this should be sufficient. This fixes several type errors. An outdated workaround has been removed from the documentation. Closes #2463
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
* Function to generate an element in development mode. | ||
* @property {Jsx | null | undefined} [jsxs] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we at least use something like Function
?
We could also improve the hast-util-to-jsx-runtime
types?
Fixing the type error is nice, but removing all type errors around this, not so sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use Function
, or better: (type: any, props: any) => any
.
We should improve hast-util-to-jsx-runtime
, but personally I think this type isn’t worth having an extra dependency regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or better:
(type: any, props: any) => any
.
Right, and even better would be an even more correct type. We do know a lot about props and key. And at that point, it’s nice to have the more complex type defined and tested in a single place?
Initial checklist
Description of changes
@types/react
now has types forreact/jsx-runtime
andreact/jsx-dev-runtime
. These types are not compatible with the types provided byhast-util-to-jsx-runtime
, which are used by MDX.To resolve the issue, all runtime related options have been changed to
unknown
. Since the user is supposed to pass in whatever JSX runtime they imported, this should be sufficient. This removes the dependency onhast-util-to-jsx-runtime
.This fixes several type errors. An outdated workaround has been removed from the documentation.
Closes #2463