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

"isOfShape" should allow keys not to be specified if that key can be undefined #35

Open
RebeccaStevens opened this issue Jul 9, 2020 · 2 comments · May be fixed by #37
Open

"isOfShape" should allow keys not to be specified if that key can be undefined #35

RebeccaStevens opened this issue Jul 9, 2020 · 2 comments · May be fixed by #37

Comments

@RebeccaStevens
Copy link
Contributor

RebeccaStevens commented Jul 9, 2020

import {
  isNumber,
  isOfShape,
  isOneOf,
  isUndefined
} from 'type-guards';

const isFoo = isOfShape({
  bar: isOneOf(isNumber, isUndefined),
  baz: isNumber
});

// This is ok.
console.log(isFoo({ bar: undefined, baz: 123 }));

// But this doesn't work.
console.log(isFoo({ baz: 123 }));
// Expect result: true
// Actual result: false
@RebeccaStevens RebeccaStevens changed the title "isOfShape" should allow allow keys not to be specified if that key can be undefined "isOfShape" should allow keys not to be specified if that key can be undefined Jul 9, 2020
RebeccaStevens pushed a commit to RebeccaStevens/type-guards that referenced this issue Jul 9, 2020
RebeccaStevens pushed a commit to RebeccaStevens/type-guards that referenced this issue Jul 9, 2020
@lazarljubenovic
Copy link
Owner

Related: #8

Thanks for submitting the issue and PR. I'll check it out during the weekend.

@RebeccaStevens
Copy link
Contributor Author

😄 Thanks for the awesome library. I'd love to help with getting this library to 1.0. Let me know if there is anything you want me to help with. I'll probably make more PRs for some of the open issues.

@RebeccaStevens RebeccaStevens linked a pull request Jul 16, 2020 that will close this issue
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 a pull request may close this issue.

2 participants