Skip to content

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

Merged
JoseLion merged 4 commits into
mainfrom
feat/add-instance-of-matcher
Aug 26, 2022
Merged

feat(assertion): Add .toBeInstanceOf(Constructor) matcher#57
JoseLion merged 4 commits into
mainfrom
feat/add-instance-of-matcher

Conversation

@JoseLion

Copy link
Copy Markdown
Contributor

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

@JoseLion JoseLion self-assigned this Aug 26, 2022
@JoseLion
JoseLion force-pushed the feat/add-instance-of-matcher branch from e0670de to 2ac753e Compare August 26, 2022 05:09
@JoseLion
JoseLion requested a review from byrpatrick August 26, 2022 14:42
import { Assertion } from "./Assertion";

export type JSObject = Record<keyof any, unknown>;
export type JSObject = Record<keyof any, any>;

Copy link
Copy Markdown
Contributor 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

@byrpatrick byrpatrick left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/lib/Assertion.ts Outdated
Comment thread test/lib/Assertion.test.ts Outdated
Comment thread test/lib/Assertion.test.ts

@byrpatrick byrpatrick left a comment

Copy link
Copy Markdown
Member

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
@github-actions

Copy link
Copy Markdown

🎉 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