Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: port the latest defineConfig type from vite #3804

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/vitest/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ 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: UserConfigExport): UserConfigExport
export function defineConfig(config: UserConfigExport): UserConfigExport {
return config
}

Expand Down