You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Types need Jest's global jest namespace: TS2694 in to-have-style.d.ts without @types/jest #1962
dist/matchers/to-have-style.d.ts types the matcher's this as jest.MatcherContext, a member of the global jest namespace that only @types/jest declares. The package's own declare global { namespace jest … } in dist/matchers/types.d.ts declares Matchers and not MatcherContext, and @types/jest is neither a dependency nor a peer dependency. So a TypeScript project that imports @testing-library/react-native without @types/jest (a Jest project that imports its globals from @jest/globals, or a Vitest one) fails its type check under skipLibCheck: false:
node_modules/@testing-library/react-native/dist/matchers/to-have-style.d.ts(4,48): error TS2694: Namespace 'global.jest' has no exported member 'MatcherContext'.
Expected behavior
Importing @testing-library/react-native type-checks in a project without @types/jest, and toHaveStyle keeps its types where Jest's are loaded.
Steps to Reproduce
In an empty folder, install the package and its peers, without @types/jest:
@testing-library/react-native main at 564a842 (2026-11-05)
== tsc --noEmit
node_modules/@testing-library/react-native/dist/matchers/to-have-style.d.ts(4,48): error TS2694: Namespace 'global.jest' has no exported member 'MatcherContext'.
RESULT: the package's types need Jest's global jest namespace (TS2694)
React Native 0.79.7 keeps the output to this one error: 0.88.1's own declarations fail the same check (react/react-native#59647).
Activity
YevheniiKotyrlo commentedon Nov 12, 2026
The patch I apply to 14.1.0 types
toHaveStyle'sthiswith the two members it reads,isNotandequals, so the declaration names nojestnamespace: