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

Cannot find module './types' or its corresponding type declarations. #23

Open
ackvf opened this issue Jan 22, 2024 · 0 comments
Open

Cannot find module './types' or its corresponding type declarations. #23

ackvf opened this issue Jan 22, 2024 · 0 comments

Comments

@ackvf
Copy link

ackvf commented Jan 22, 2024

Hi, when I tried to use the following utility, I converted my tailwind.config.js to .ts to get better intellisense

import tailwindConfig from 'tailwind-config'
import resolveConfig from 'tailwindcss/resolveConfig'

const twFullConfig = resolveConfig(tailwindConfig)

// twFullConfig.theme.colors.dark[100] // 🗸

But then I started receiving strange errors and it's rather confusing

This doesn't work

// tailwind.config.ts
import { themeVariants } from 'tailwindcss-theme-variants'
import { type Config } from 'tailwindcss'


// The inferred type of 'twConfig' cannot be named without a reference to 'tailwindcss-theme-variants/node_modules/tailwindcss/types/config'. This is likely not portable. A type annotation is necessary.ts(2742)
const config = { /* ... */ } as const satisfies Config

export default config

This works

const config: Config = { /* ... */ }

Which finally led me to this error

$ tsc tailwind.config.ts
../../node_modules/tailwindcss-theme-variants/index.d.ts:1:40 - error TS2307: Cannot find module './types' or its corresponding type declarations.

1: import type { ThisPluginOptions } from "./types";

And when I look in the module, there is really no such folder.

image

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

1 participant