From 805ac1c6fe7f1a0c6664bd23fdc1d436e98c135e Mon Sep 17 00:00:00 2001 From: nyaapass <13141973+nyaapass@users.noreply.github.com> Date: Mon, 11 Mar 2024 23:51:51 +0900 Subject: [PATCH 1/2] fix: proper vitest ts support (#515) --- types/vitest.d.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/types/vitest.d.ts b/types/vitest.d.ts index a19295b..2809ffb 100644 --- a/types/vitest.d.ts +++ b/types/vitest.d.ts @@ -1,11 +1,16 @@ -import {type expect} from 'vitest' +/* eslint-disable @typescript-eslint/no-shadow */ + +import {type Assertion, type AsymmetricMatchersContaining} from 'vitest' import {type TestingLibraryMatchers} from './matchers' export {} -declare module '@vitest/expect' { - interface JestAssertion + +// https://vitest.dev/guide/extending-matchers.html +declare module 'vitest' { + interface Assertion extends TestingLibraryMatchers< ReturnType, T > {} + interface AsymmetricMatchersContaining extends TestingLibraryMatchers {} } From 96e785ba0ec48736448cf180dc2987a2544c794f Mon Sep 17 00:00:00 2001 From: nyaapass <13141973+nyaapass@users.noreply.github.com> Date: Tue, 12 Mar 2024 01:32:10 +0900 Subject: [PATCH 2/2] fix: use vitest's `expect` (#589) --- types/vitest.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/vitest.d.ts b/types/vitest.d.ts index 2809ffb..97fffe2 100644 --- a/types/vitest.d.ts +++ b/types/vitest.d.ts @@ -1,6 +1,10 @@ /* eslint-disable @typescript-eslint/no-shadow */ -import {type Assertion, type AsymmetricMatchersContaining} from 'vitest' +import { + type Assertion, + type AsymmetricMatchersContaining, + type expect, +} from 'vitest' import {type TestingLibraryMatchers} from './matchers' export {}