Skip to content

Commit

Permalink
skip ts-expect-error
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Nov 4, 2024
1 parent 1123db2 commit e79adb9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/nuxt/.nuxtrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
imports.autoImport=false
typescript.includeWorkspace=true
experimental.typescriptBundlerResolution=true
modules[]=@nuxtjs/tailwindcss
1 change: 1 addition & 0 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@nuxt/module-builder": "^0.5.5",
"@nuxt/schema": "^3.11.2",
"@nuxt/test-utils": "^3.12.0",
"@nuxtjs/tailwindcss": "^6.12.2",
"@uploadthing/eslint-config": "workspace:*",
"eslint": "^8.57.0",
"h3": "^1.11.1",
Expand Down
14 changes: 9 additions & 5 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
useLogger,
} from "@nuxt/kit";
import type { Resolver } from "@nuxt/kit";
import type { Nuxt } from "@nuxt/schema";
import type { Nuxt, NuxtOptions } from "@nuxt/schema";
import type { ModuleOptions as TailwindModuleOptions } from "@nuxtjs/tailwindcss";
import defu from "defu";

import type { RouteHandlerConfig } from "uploadthing/internal/types";
Expand All @@ -30,6 +31,10 @@ export type ModuleOptions = RouteHandlerConfig & {
injectStyles: boolean;
};

interface NuxtOptionsWithTailwind extends NuxtOptions {
tailwindcss?: Partial<TailwindModuleOptions>;
}

export default defineNuxtModule<ModuleOptions>({
meta: {
name: "@uploadthing/nuxt",
Expand Down Expand Up @@ -138,10 +143,9 @@ async function injectStyles(
`,
});

// @ts-expect-error - Help pls
const twModuleOptions = (nuxt.options.tailwindcss ??= {}) as {
configPath?: string | string[];
};
const twModuleOptions = ((
nuxt.options as NuxtOptionsWithTailwind
).tailwindcss ??= {});
if (typeof twModuleOptions.configPath === "string") {
twModuleOptions.configPath = [twModuleOptions.configPath, template.dst];
} else if (Array.isArray(twModuleOptions.configPath)) {
Expand Down
30 changes: 28 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e79adb9

Please sign in to comment.