mdx-bundler production type check conflict
What version of Remix are you using?
1.1.1
What version of Node are you using? Minimum supported version is 14.
16.13.1
Steps to Reproduce
- Clone https://github.com/zslabs/zslabs-remix
npm inpm run dev- Visit
/about - You'll notice content pulled-in from
content/posts/hello-world.mdxthat is parsed viamdx-bundlerinside ofapp/routes/about.tsx - Stop server
- Run
npm run type:check - Remix complains about duplicated mdx exports. Confused about the issue ❓
Expected Behavior
npm run type:check completes successfully
Actual Behavior
Running npm run type:check produces the following:
> zslabs-remix@ type:check /Users/zach/Sites/zslabs-remix
> tsc --project tsconfig.json --pretty --noEmit
node_modules/@remix-run/dev/modules.d.ts:35:20 - error TS2300: Duplicate identifier 'default'.
35 export default Component;
~~~~~~~~~
node_modules/@types/mdx/index.d.ts:76:14
76 export { default } from '*.mdx';
~~~~~~~
'default' was also declared here.
node_modules/@types/mdx/index.d.ts:76:14 - error TS2300: Duplicate identifier 'default'.
76 export { default } from '*.mdx';
~~~~~~~
node_modules/@remix-run/dev/modules.d.ts:35:20
35 export default Component;
~~~~~~~~~
'default' was also declared here.
node_modules/mdx-bundler/dist/types.d.ts:197:36 - error TS2304: Cannot find name 'MDXContentProps'.
197 default: React.FunctionComponent<MDXContentProps>
~~~~~~~~~~~~~~~
Found 3 errors.
Adding "skipLibCheck": true to my tsconfig.json file did the trick
https://www.typescriptlang.org/tsconfig#skipLibCheck
It'd still be nice to know if this would be a recommended setting moving forward we should add to Remix, or if there's still something I'm missing on my end.
I get 22 errors with conflict between node_modules/typescript/lib/lib.dom.d.ts and node_modules/typescript/lib/lib.webworker.d.ts

This seems to be due to the fact that both Remix and @types/mdx are declaring types for all *.md/*.mdx files. Apart from setting skipLibCheck to true which I agree doesn't seem ideal, I'm not sure how best to deal with this. Either way I don't think this is something we can deal with on the Remix side. Since mdx-bundler doesn't seem to need any global types set, maybe you could raise this as an issue upstream?