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: cover isOptional case with return null #7

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

borracciaBlu
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Aug 4, 2022

Codecov Report

Merging #7 (9761b47) into main (50c31ad) will not change coverage.
The diff coverage is n/a.

❗ Current head 9761b47 differs from pull request most recent head ecc4d9a. Consider uploading reports for the commit ecc4d9a to get more accurate results

@@           Coverage Diff           @@
##             main       #7   +/-   ##
=======================================
  Coverage   95.02%   95.02%           
=======================================
  Files          58       58           
  Lines         603      603           
=======================================
  Hits          573      573           
  Misses         30       30           

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@borracciaBlu
Copy link
Contributor Author

Hi @medikoo ,

I've just realised that the types were not covering the isOptional case...

isOptional - Makes null or undefined accepted as valid value. In such case instead of TypeError being thrown, null is returned.
default - A value to be returned if null or undefined is passed as an input value.

I've assumed that default will be forced of the same type of the ensure function.
Let me know.

Copy link
Owner

@medikoo medikoo left a comment

Choose a reason for hiding this comment

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

Thank you @borracciaBlu, looks great 👍

@medikoo medikoo self-assigned this Aug 4, 2022
@medikoo medikoo merged commit 320f89b into medikoo:main Aug 4, 2022
@borracciaBlu borracciaBlu deleted the update/ts-types-optional branch August 4, 2022 22:03
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.

2 participants