For me, it helped to just rename the vitest.d.ts file to e.g. custom-vitest.d.ts
The issue was that typescript resolved "vitest" to "vitest.d.ts" so that the module declared in the d.ts file was overriding the default vitest module instead of just extending it. Renaming the file solved this.
Also remember to add the "custom-vitest.d.ts" file to the "include" array in your tsconfig.json