Skip to content

Commit 01c2780

Browse files
authored
fix(expect): allow expect.Matchers generic with single value (#11986)
1 parent 7b857d5 commit 01c2780

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Fixes
66

7+
- `[expect]` Allow again `expect.Matchers` generic with single value ([#11986](https://github.com/facebook/jest/pull/11986))
8+
79
### Chore & Maintenance
810

911
### Performance

packages/expect/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ const expectExport = expect as Expect;
431431

432432
declare namespace expectExport {
433433
export type MatcherState = JestMatcherState;
434-
export interface Matchers<R, T> extends MatcherInterface<R, T> {}
434+
export interface Matchers<R, T = unknown> extends MatcherInterface<R, T> {}
435435
}
436436

437437
export = expectExport;

test-types/expect.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import type * as expect from 'expect';
9+
10+
export type M = expect.Matchers<void, unknown>;
11+
export type N = expect.Matchers<void>;
12+
// @ts-expect-error
13+
export type E = expect.Matchers<>;

0 commit comments

Comments
 (0)