Closed pereriksson closed 3 weeks ago
Hello @pereriksson. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction
will be closed if they have no activity within 3 days.
@AriPerkkio done!
This is an issue with Vite's defineConfig
override. It doesn't provide an overload for an async function:
declare function defineConfig(config: UserConfig): UserConfig;
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
+ declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
declare function defineConfig(config: UserConfigExport): UserConfigExport;
I'd suggest opening an issue in Vite repo. You can see that your code works if a callback is sync:
export default defineConfig(() => {})
@sheremet-va thanks a lot
Prerequisites
Describe the bug
When configuring the vitest framework, and the vite config is defined using a function like so:
everything works, but typescript complains about
viteConfig(env)
that:Reproduction
System Info
Used Package Manager
npm
Validations