CaptainNemo
CaptainNemo2y ago

Convex dev errors because of MDX types in Astro

I have an Astro project with a Preact component in it, and I'm using Convex in that component, following the React Quickstart on the Convex docs. But I get this error when I run npx convex dev:
node_modules/@types/mdx/types.d.ts:22:19 - error TS2503: Cannot find namespace 'JSX'.

22 [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]>;
~~~
node_modules/@types/mdx/types.d.ts:22:19 - error TS2503: Cannot find namespace 'JSX'.

22 [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]>;
~~~
The bizarre thing is that it did work at one point, so I can actually run the whole project and it runs fine (because the generated types exist). But I can't get it to work anymore, so future changes to my schema are not picked up. Even stepping back in my git history to when it definitely worked does not fix it. I'm new to Convex, so maybe I'm missing something obvious like clearing a .gitignored folder or something. (I don't see any obvious culprits in my .gitignore though.) I loved the wind-in-my-hair feeling of running npx convex dev the first time, when it set up my project for me and everything, but this error is the opposite of that. :/ Feeling very stuck.
2 Replies
ballingt
ballingt2y ago
@CaptainNemo Looks sort of like this? https://github.com/withastro/astro/issues/5061 You can try using convex without typechecking, npx convex dev --typecheck=disable and just get your types in your editor or the solution suggested there, add skipLibCheck to the tsconfig.json at convex/tsconfig.json Adding skipLibCheck seems like a a pretty sensible thing to do in this case since Astro is doing is it already https://github.com/withastro/astro/pull/5872
CaptainNemo
CaptainNemoOP2y ago
That worked!! Thank you so much for your help!

Did you find this page helpful?