Skip to content

Conversation

@JoseLion
Copy link
Contributor

@JoseLion JoseLion commented Nov 8, 2022

This PR corrects the types of the TypeFactories.instanceOf(..) helper. The issue was that the assertion factory was creating an assertion for the constructor instead of the instance. Using the alias Constructor<T> instead resolves the issue as the assertion factory will create an instance for T instead.

Example:

class Car {

  private model: string;

  constructor(model: string) {
    this.mode = model;
  }
}

expect(value)
  .asType(TypeFactories.instanceOf(Car))
  .toBeEqual(new Car("Porsche 911"));

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 c00bd31 into main Nov 22, 2022
@JoseLion JoseLion deleted the fix/instanceof-type-factory branch November 22, 2022 23:22
@github-actions
Copy link

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

3 participants