TailwindCss typescript error in config

I have a question regarding the implementation of the tailwind.config.js that uses the custom default props and has theme as a prop in the typography specification.

How do you make it work in typescript environment?

typography: (theme) => ({ 

      DEFAULT: {
        css: {
          '--tw-prose-body': theme('colors.zinc.600'),
          '--tw-prose-headings': theme('colors.zinc.900'),
          '--tw-prose-links': theme('colors.teal.500'),
          '--tw-prose-links-hover': theme('colors.teal.600'),
          '--tw-prose-underline': theme('colors.teal.500 / 0.2'),
          '--tw-prose-underline-hover': theme('colors.teal.500'),
          '--tw-prose-bold': theme('colors.zinc.900'),
          '--tw-prose-counters': theme('colors.zinc.900'),
          '--tw-prose-bullets': theme('colors.zinc.900'),
          '--tw-prose-hr': theme('colors.zinc.100'),


The theme gives me error. Also if I do : any I get a different error that it is not a ts file.

Parameter 'theme' implicitly has an 'any' type.ts(7006)

Type annotations can only be used in TypeScript files.ts(8010)
Was this page helpful?