remix icon indicating copy to clipboard operation
remix copied to clipboard

mdx-bundler production type check conflict

Open zslabs opened this issue 3 years ago • 2 comments

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 i
  • npm run dev
  • Visit /about
  • You'll notice content pulled-in from content/posts/hello-world.mdx that is parsed via mdx-bundler inside of app/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.

zslabs avatar Jan 09 '22 22:01 zslabs

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.

zslabs avatar Jan 18 '22 02:01 zslabs

I get 22 errors with conflict between node_modules/typescript/lib/lib.dom.d.ts and node_modules/typescript/lib/lib.webworker.d.ts CleanShot 2022-10-23 at 22 44 59@2x

davidfilat avatar Oct 23 '22 19:10 davidfilat

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?

markdalgleish avatar Aug 17 '23 04:08 markdalgleish