diff --git a/src/esbuild.ts b/src/esbuild.ts index c08d52f..8713ee7 100644 --- a/src/esbuild.ts +++ b/src/esbuild.ts @@ -1,6 +1,6 @@ import { createEsbuildPlugin } from 'unplugin' import type { EsbuildPlugin } from 'unplugin' import { unpluginFactory } from './index' -import type { UnpluginStylexOptions } from './types' +import type { UnpluginStylexInstance } from './types' -export default createEsbuildPlugin(unpluginFactory) as (options?: UnpluginStylexOptions) => EsbuildPlugin +export default createEsbuildPlugin(unpluginFactory) as UnpluginStylexInstance diff --git a/src/rspack.ts b/src/rspack.ts index 2945dfd..6239cf8 100644 --- a/src/rspack.ts +++ b/src/rspack.ts @@ -1,6 +1,6 @@ import { createRspackPlugin } from 'unplugin' import type { RspackPluginInstance } from 'unplugin' import { unpluginFactory } from './index' -import type { UnpluginStylexOptions } from './types' +import type { UnpluginStylexInstance } from './types' -export default createRspackPlugin(unpluginFactory) as (options?: UnpluginStylexOptions) => RspackPluginInstance +export default createRspackPlugin(unpluginFactory) as UnpluginStylexInstance diff --git a/src/types.ts b/src/types.ts index db6e2f5..f1cb048 100644 --- a/src/types.ts +++ b/src/types.ts @@ -24,3 +24,5 @@ export type UnpluginStylexOptions = { enforce?: 'post' | 'pre' stylex?: StylexOptions } + +export type UnpluginStylexInstance = (options?: UnpluginStylexOptions) => T diff --git a/src/vite.ts b/src/vite.ts index 58f0a29..9c73bfe 100644 --- a/src/vite.ts +++ b/src/vite.ts @@ -1,6 +1,6 @@ import { createVitePlugin } from 'unplugin' import type { VitePlugin } from 'unplugin' import { unpluginFactory } from './index' -import type { UnpluginStylexOptions } from './types' +import type { UnpluginStylexInstance } from './types' -export default createVitePlugin(unpluginFactory) as (option?: UnpluginStylexOptions) => VitePlugin +export default createVitePlugin(unpluginFactory) as UnpluginStylexInstance