Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error in the config: Binding element 'theme' implicitly has an 'any' type. #335

Open
illright opened this issue Feb 15, 2024 · 2 comments

Comments

@illright
Copy link

What version of @tailwindcss/typography are you using?

v0.5.10

What version of Node.js are you using?

v18.18.0

What browser are you using?

N/A

What operating system are you using?

Linux

Reproduction repository

https://stackblitz.com/edit/vitejs-vite-pjylzr?file=tailwind.config.ts

Describe your issue

When accessing the theme function in the tailwind.config.ts file for the typography key, there is a TypeScript error Binding element 'theme' implicitly has an 'any' type..

Here's the problematic config:

import typography from '@tailwindcss/typography';

/** @type {import('tailwindcss').Config} */
export default {
  content: [],
  theme: {
    extend: {
      // Binding element 'theme' implicitly has an 'any' type.
      typography: ({ theme }) => ({
        DEFAULT: {
          css: {
            color: theme('colors.pink[800]'),
          },
        },
      }),
    },
  },
  plugins: [typography],
};

I managed to work around this by importing PluginUtils and making that the type of the { theme } object:

 import type { PluginUtils } from "tailwindcss/types/config";
 export default {
   theme: {
    extend: {
       typography: ({ theme }: PluginUtils) => ({})
    }
  }
}
@meghantosh
Copy link

Thank you! That also worked for me

@petrpacas
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants