How to specify the type of JS Expressions in MDX (with MDX LSP)? #2639
Unanswered
guyutongxue
asked this question in
Q&A
Replies: 1 comment
-
Hi @guyutongxue 👋 All markdown syntax is considered JSX fragments. The only reason is that this simply hasn’t come up yet. The current approach is sufficient for most JSX frameworks. Your use case makes sense though. The fix should also be fairly easy. Please report this bug in I am currently very busy though, so I simply don’t have the time to fix it anytime soon. But if you can fix it, I may be able to slip in some time to review and release it. |
Beta Was this translation helpful? Give feedback.
0 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.
-
I'm working on a project that uses MDX to describe a set of e2e testing operations. In this setup, each Markdown list item (
<li>
) is converted—using a custom JSX factory and runtime—into either a prompt for an LLM agent or a function to be executed manually or programmatically. For example:However, when using the
mdx-analyzer
language server with thecheckMdx
option enabled, I'm running into a TypeScript error. Specifically, the TypeScript checker cannot determine the type of thechildren
prop for the default MDX<li>
element, so it issues an error at the function signature:What I'm trying to do is specify the type of the
children
prop for the built-in<li>
element in MDX, so that TypeScript can correctly check functions provided as children. Ideally, I want to define something like:Is there a way to achieve this, so that TypeScript will recognize the correct type inside MDX files? Any suggestions would be appreciated—thank you! 🙏
Beta Was this translation helpful? Give feedback.
All reactions