Rename and update vitest type declarations

Rename vitest.d.ts to vitest-setup.d.ts to avoid TypeScript module resolution
conflicts. Add custom matcher type declarations directly in this file following
Vitest documentation recommendations with import statement.
This commit is contained in:
Dannon Baker
2025-11-24 10:09:27 -05:00
parent d9875952ac
commit 2fbe96cad7
@@ -1,4 +1,13 @@
import "vitest";
// Custom matchers from tests/vitest/helpers.js
interface CustomMatchers<R = unknown> {
toBeLocalized(): R;
toBeLocalizationOf(str: string): R;
}
declare module "vitest" {
// Export vitest functions for explicit imports (non-globals mode)
export const describe: (typeof import("vitest/dist/index.js"))["describe"];
export const it: (typeof import("vitest/dist/index.js"))["it"];
export const test: (typeof import("vitest/dist/index.js"))["test"];
@@ -8,4 +17,8 @@ declare module "vitest" {
export const afterEach: (typeof import("vitest/dist/index.js"))["afterEach"];
export const beforeAll: (typeof import("vitest/dist/index.js"))["beforeAll"];
export const afterAll: (typeof import("vitest/dist/index.js"))["afterAll"];
// Custom matcher type augmentations for Vitest 4.x
interface Assertion<T = any> extends CustomMatchers<T> {}
interface AsymmetricMatchersContaining extends CustomMatchers {}
}