Skip to content
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

(@mdx-js/react) Where is the exported Components type? #2104

Closed
4 tasks done
khinshankhan opened this issue Aug 15, 2022 · 4 comments
Closed
4 tasks done

(@mdx-js/react) Where is the exported Components type? #2104

khinshankhan opened this issue Aug 15, 2022 · 4 comments
Labels
📚 area/docs This affects documentation ☂️ area/types This affects typings 💪 phase/solved Post is done 🦋 type/enhancement This is great to have

Comments

@khinshankhan
Copy link

Initial checklist

Affected packages and versions

@mdx-js/react^2.1.2

Link to runnable example

Steps to reproduce

Install the package @mdx-js/react and try to import mdx components type.

Expected behavior

Until recently I was on an old version of v1, which had MDXProviderComponentsProp as an available when using @types/mdx-js__react + https://mdxjs.com/packages/react/#types seemed to indicate it was exported? So, I expected there to be an export for Components.

Actual behavior

Components is not available

image

Seeing https://github.com/mdx-js/mdx/blob/main/packages/react/index.js didn't export it, I figured out after going through the package to install mdx/types and am now using MDXComponents ie import { MDXComponents } from "mdx/types";.

If this is the proper way to use the type, I think https://mdxjs.com/packages/react/#types might be a little misleading and could include the bit to install the package to use this type. Actually, it should probably link to https://mdxjs.com/docs/getting-started/#types?

Runtime

Node v16

Package manager

pnpm

OS

Linux

Build and bundle tools

Gatsby

@wooorm
Copy link
Member

wooorm commented Aug 15, 2022

Types are in @types/mdx indeed, as documented in the Types section of the Getting started docs.
It is indeed correct that the docs for @mdx-js/react are out of date (and likely also for preact, vue). A PR improving them, including a link you mention, would be appreciated!

@wooorm
Copy link
Member

wooorm commented Aug 23, 2022

@khinshankhan Interested in working on a PR?

@wooorm wooorm added 🦋 type/enhancement This is great to have 📚 area/docs This affects documentation ☂️ area/types This affects typings 👍 phase/yes Post is accepted and can be worked on labels Aug 23, 2022
@khinshankhan
Copy link
Author

Sure. I only know + tested with react, so should I only update the react docs or just use generic terminology for all the frameworks?

@wooorm
Copy link
Member

wooorm commented Aug 24, 2022

You can see that our packages for react, preact, and vue, each have the exact same types section.
Depending on what wording you think of for react, I don’t think it needs to be specific to React either, I am thus assuming that the same wording can be reused for the others!

@wooorm wooorm closed this as completed in 1c83612 Dec 8, 2022
@wooorm wooorm added 💪 phase/solved Post is done and removed 👍 phase/yes Post is accepted and can be worked on labels Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 area/docs This affects documentation ☂️ area/types This affects typings 💪 phase/solved Post is done 🦋 type/enhancement This is great to have
Development

No branches or pull requests

2 participants