Skip to content

Commit

Permalink
fix: port the latest defineConfig type from vite (#3804)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang authored Jul 28, 2023
1 parent b7ce195 commit 9c8e308
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vitest/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ export { configDefaults, defaultInclude, defaultExclude, coverageConfigDefaults
export { mergeConfig } from 'vite'

export type { ConfigEnv, ViteUserConfig as UserConfig }
export type UserConfigFnObject = (env: ConfigEnv) => ViteUserConfig
export type UserConfigFnPromise = (env: ConfigEnv) => Promise<ViteUserConfig>
export type UserConfigFn = (env: ConfigEnv) => ViteUserConfig | Promise<ViteUserConfig>
export type UserConfigExport = ViteUserConfig | Promise<ViteUserConfig> | UserConfigFn
export type UserConfigExport = ViteUserConfig | Promise<ViteUserConfig> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn

export type UserProjectConfigFn = (env: ConfigEnv) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>
export type UserProjectConfigExport = UserWorkspaceConfig | Promise<UserWorkspaceConfig> | UserProjectConfigFn

export function defineConfig(config: UserConfigExport) {
export function defineConfig(config: ViteUserConfig): ViteUserConfig
export function defineConfig(config: Promise<ViteUserConfig>): Promise<ViteUserConfig>
export function defineConfig(config: UserConfigFnObject): UserConfigFnObject
export function defineConfig(config: UserConfigExport): UserConfigExport
export function defineConfig(config: UserConfigExport): UserConfigExport {
return config
}

Expand Down

0 comments on commit 9c8e308

Please sign in to comment.