From eee2f7b720798343c31a2ae44a23dcf8a6605c5a Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sat, 4 Jul 2020 15:06:46 +0200 Subject: [PATCH] Fix t.like() selector type See https://github.com/avajs/ava/issues/2518#issuecomment-651771859 --- index.d.ts | 2 +- test-d/like.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 029921567..8bd9a58e2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -130,7 +130,7 @@ export interface DeepEqualAssertion { export interface LikeAssertion { /** Assert that `value` is like `selector`. */ - (value: any, selector: Record, message?: string): void; + (value: any, selector: Record, message?: string): void; /** Skip this assertion. */ skip(value: any, selector: any, message?: string): void; diff --git a/test-d/like.ts b/test-d/like.ts index d5b9a18b0..5dd772c4d 100644 --- a/test-d/like.ts +++ b/test-d/like.ts @@ -13,5 +13,13 @@ test('like', t => { baz: 'thud' } }); -}); + type Foo = { + foo?: 'foo'; + bar?: 'bar'; + }; + + const foo: Foo = {bar: 'bar'}; + const {foo: _, ...expected} = foo; + t.like({bar: 'bar'}, expected); +});