tailwindlabs / tailwindui-issues

A place to report bugs discovered in Tailwind UI.
234 stars 4 forks source link

"TS2307: Cannot find module 'mdx/types' or its corresponding type declarations." in the template "Studio", mdx-components.tsx, when using "pnpm" #1496

Closed rsipakov closed 1 year ago

rsipakov commented 1 year ago

Template: "Studio" File: mdx-components.tsx

import { type MDXComponents as MDXComponentsType } from 'mdx/types'
import { MDXComponents } from '@/components/MDXComponents'

export function useMDXComponents(components: MDXComponentsType) {
  return {
    ...components,
    ...MDXComponents,
  }
}

Error message: TS2307: Cannot find module 'mdx/types' or its corresponding type declarations. Warning message: Unused function useMDXComponents

Describe the bug When using pnpm we have mentioned above the error and warning messages. When use npm we have only a warning message.

We tried to resolve this issue via:

But the error persisted in the case if we use pnpm

bradlc commented 1 year ago

Hey @rsipakov, thanks for reporting this. The issue has been fixed in the latest version of the template. You can either re-download the template, or apply the fix yourself if you prefer, which is to install @types/mdx:

pnpm install @types/mdx

I hope that helps!