Skip to content

Commit

Permalink
Use type generic to define the type of defineConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
vinassefranche committed Jul 26, 2023
1 parent df77991 commit d965544
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/vite/src/node/config.ts
Expand Up @@ -117,10 +117,9 @@ export type UserConfigExport =
* The function receives a {@link ConfigEnv} object that exposes two properties:
* `command` (either `'build'` or `'serve'`), and `mode`.
*/
export function defineConfig(config: UserConfig): UserConfig
export function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>
export function defineConfig(config: UserConfigExport): UserConfigExport
export function defineConfig(config: UserConfigExport): UserConfigExport {
export function defineConfig<Config extends UserConfigExport>(
config: Config,
): Config {
return config
}

Expand Down

0 comments on commit d965544

Please sign in to comment.