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

feat(assertion): Add .toBeInstanceOf(Constructor) matcher #57

Merged
merged 4 commits into from
Aug 26, 2022

Conversation

JoseLion
Copy link
Member

This PR add a .toBeInstanceOf(Constructor) matcher to the the base Assertion<T> class.

@JoseLion JoseLion self-assigned this Aug 26, 2022
@@ -3,7 +3,7 @@ import { isDeepStrictEqual } from "util";

import { Assertion } from "./Assertion";

export type JSObject = Record<keyof any, unknown>;
export type JSObject = Record<keyof any, any>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes issues with type inference in generic constraints. The type unknown is too specific to be part of a constraint

Copy link
Member

@byrpatrick byrpatrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoseLion is looking good!
I left some comments and suggestions!

In general, I think it's more natural to relate an instance with a class and not with its constructor.

src/lib/Assertion.ts Outdated Show resolved Hide resolved
test/lib/Assertion.test.ts Outdated Show resolved Hide resolved
test/lib/Assertion.test.ts Show resolved Hide resolved
Copy link
Member

@byrpatrick byrpatrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! 💯

@JoseLion JoseLion merged commit 48c43f0 into main Aug 26, 2022
@JoseLion JoseLion deleted the feat/add-instance-of-matcher branch August 26, 2022 23:22
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants