diff --git a/jest.setup.ts b/jest.setup.ts index b3a15d4bf..47705848c 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -12,6 +12,11 @@ import failOnConsole from "jest-fail-on-console"; import * as globalStorybookConfig from "./.storybook/preview"; import "jest-axe/extend-expect"; +// `@types/jest-axe` doesn't extend `expect` when imported from `@jest/globals`. +// This manually sets the correct type. Note that it has to extend the +// TestingLibraryMatchers to avoid overriding those. +// Also see +// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67495 declare module "expect" { interface Matchers extends TestingLibraryMatchers {