Skip to content

Commit eee2f7b

Browse files
committed
Fix t.like() selector type
See #2518 (comment)
1 parent b154612 commit eee2f7b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export interface DeepEqualAssertion {
130130

131131
export interface LikeAssertion {
132132
/** Assert that `value` is like `selector`. */
133-
(value: any, selector: Record<string, unknown>, message?: string): void;
133+
(value: any, selector: Record<string, any>, message?: string): void;
134134

135135
/** Skip this assertion. */
136136
skip(value: any, selector: any, message?: string): void;

test-d/like.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@ test('like', t => {
1313
baz: 'thud'
1414
}
1515
});
16-
});
1716

17+
type Foo = {
18+
foo?: 'foo';
19+
bar?: 'bar';
20+
};
21+
22+
const foo: Foo = {bar: 'bar'};
23+
const {foo: _, ...expected} = foo;
24+
t.like({bar: 'bar'}, expected);
25+
});

0 commit comments

Comments
 (0)