Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SvelteKit: "No overload matches this call" error invite.config.js when working with vitest

I just created an app with pnpx sv create sveltekit-test2

and checked vitest

and now when I run pnpm check I get this error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Loading svelte-check in workspace: /home/sas/devel/apps/dgiit/proyectos/tmp/sveltekit-test
Getting Svelte diagnostics...

/home/sas/devel/apps/dgiit/proyectos/tmp/sveltekit-test/vite.config.ts:5:12
Error: No overload matches this call.
  The last overload gave the following error.

this is my vite.config.js

import { defineConfig } from "vitest/config";
import { sveltekit } from '@sveltejs/kit/vite';

export default defineConfig({
    plugins: [sveltekit()],

    test: {
        include: ['src/**/*.{test,spec}.{js,ts}']
    }
});

and here’s the same error on vscode

enter image description here

the defineConfig from the vite package works ok, btw

enter image description here

>Solution :

This is probably a compatiblity issue between Vitest and Vite 6. See this comment:

As @dummdidumm mentioned, this is an issue of having multiple Vite versions. vitest just recently reverted their Vite 6 support in their v2.1.7 release, causing Vite 5 & 6 to be installed and the types to be mismatched

Reverting Vite to v5 might work, I have also seen somewhere that the Vitest v3 beta also fixes this.

This should just be a type error, so you could probably ignore it using an instruction like // @ts-expect-error.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading