Skip to content

Commit

Permalink
feat: backport types of defineConfig from vite
Browse files Browse the repository at this point in the history
  • Loading branch information
vinassefranche committed Jul 27, 2023
1 parent b7ce195 commit b25f817
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/vitest/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ 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: 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) {
return config
}
Expand Down

0 comments on commit b25f817

Please sign in to comment.