Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix equal() types #173

Merged
merged 2 commits into from Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/index.d.ts
Expand Up @@ -343,7 +343,7 @@ declare namespace expect {
*
* @returns assertion chain object.
*/
equal(value: T, options?: Hoek.deepEqual.Options): this;
equal(value: Loosely<T>, options?: Hoek.deepEqual.Options): this;

/**
* Asserts that the reference value equals the provided value.
Expand All @@ -353,7 +353,7 @@ declare namespace expect {
*
* @returns assertion chain object.
*/
equals(value: T, options?: Hoek.deepEqual.Options): this;
equals(value: Loosely<T>, options?: Hoek.deepEqual.Options): this;

/**
* Asserts that the reference value has the provided instanceof value.
Expand Down
3 changes: 3 additions & 0 deletions test/index.ts
Expand Up @@ -181,6 +181,9 @@ Code.expect(['abc', 'def']).to.match(/^[\w\d,]*$/);
Code.expect(1).to.match(/^\d$/);
Code.expect('x').to.satisfy(value => value === 'x');

const type2 = { a: [1], c: [2] };
Code.expect(type2).to.equal({ a: [1] }, { skip: ['c'] });

const rejection = Promise.reject(new Error('Oh no!'));

await expect.type<Promise<any>>(Code.expect(rejection).to.reject('Oh no!'));
Expand Down