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(utils): support boolean in types-checks and error-handlers #373

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

vplasencia
Copy link
Member

Description

This PR adds support to check boolean values in the TypeChecks and ErrorHandlers modules.

Related Issue(s)

Closes #372

Checklist

  • I have read and understand the contributor guidelines and code of conduct.
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn style without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Important

We do not accept minor grammatical fixes (e.g., correcting typos, rewording sentences) unless they significantly improve clarity in technical documentation. These contributions, while appreciated, are not a priority for merging. If there is a grammatical mistake, please feel free to message the team.

@@ -137,6 +147,7 @@ describe("# type-checks", () => {

it("Should return false if the value type is not the one expected or is not supported", () => {
expect(isType("string", "number")).toBeFalsy()
expect(isType(1, "boolean")).toBeFalsy()
expect(isType(1, "string")).toBeFalsy()
expect(isType(1, "function")).toBeFalsy()
expect(isType(1, "Array")).toBeFalsy()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not vital in this PR, but it would be nice to flesh out the testing of isSupportedType below so it actually checks each of the types. This occurs to me because I was looking for a utest change corresponding to each functional code change, and the change to supporeted types has no corresponding test.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey @artwyman! Thank you very much for the review. Yes, it makes sense. I just added the remaining types to the Should return true if the type is supported test.

Does this cover what you needed?

Copy link
Collaborator

@artwyman artwyman left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@vplasencia vplasencia merged commit cd0ed03 into main Jan 31, 2025
2 checks passed
Copy link

gitpoap-bot bot commented Jan 31, 2025

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2025 ZK-KIT Contributor:

GitPOAP: 2025 ZK-KIT Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@vplasencia vplasencia deleted the feat/utils-error-handlers-boolean branch January 31, 2025 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support requireBoolean in the @zk-kit/utils/error-handlers module
2 participants