-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Hi all,
TailwindCSS version: 4.1.12
TailwindCSS plugin version: 4.1.12
SolidStart version: 1.1.0
Solid version: 1.9.5
Vinxi: 0.5.7
Node version: 22.13.1
NPM version: 11.5.2
Browser version seems irrelevant, as error happens before anything is shown at all.
OS: Windows 11
Reproduction URL: https://github.com/KipzonderKop101/tailwindcss-typing-issue-reproduction
Let's start off by thanking the team for the plugin in the first place. It's been a breath of fresh air.
However, I had an issue with my new SolidStart application. While configuring my app.config.ts I got a typing error. I've had this issue before and got around it by using Tailwind's CLI, which meant I lost HRM updates. Because of this, I looked into it, and configured the plugins such as SolidStart describes, which left me with the following configuration.
import { defineConfig } from "@solidjs/start/config";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
vite: {
plugins: [tailwindcss()],
},
});This configuration should be perfect on paper, but it gave me the following error. Which of course is the typing error I described.
Type 'Plugin$1<any>[]' is not assignable to type 'PluginOption'.
Type 'Plugin$1<any>[]' is not assignable to type 'PluginOption[]'.
Type 'Plugin$1<any>' is not assignable to type 'PluginOption'.
Type 'Plugin$1<any>' is not assignable to type 'Plugin<any>'.
Types of property 'hotUpdate' are incompatible.
Type 'ObjectHook<(this: MinimalPluginContext & { environment: DevEnvironment; }, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<...>> | undefined' is not assignable to type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined'.
Type '(this: MinimalPluginContext & { environment: DevEnvironment; }, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<...>' is not assignable to type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined'.
Type '(this: MinimalPluginContext & { environment: DevEnvironment; }, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<...>' is not assignable to type '(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>'.
The 'this' types of each signature are incompatible.
Type 'HotUpdatePluginContext' is not assignable to type 'MinimalPluginContext & { environment: DevEnvironment; }'.
Type 'HotUpdatePluginContext' is missing the following properties from type 'MinimalPluginContext': debug, error, info, meta, warnts(2322)
So as to reproduce, create a new project with SolidStart and install the latest version of the TailwindCSS Vite plugin. After the configuration mentioned earlier you should get the error.
As to solve the error for now, you can cast the plugin as an any type, which of course is suboptimal.
import { defineConfig } from "@solidjs/start/config";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
vite: {
// Cast as any untill Tailwindcss is updated to use Vite 6
plugins: [tailwindcss() as any],
},
});Hope this helps!