Skip to content

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

@ackvf

Description

@ackvf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions