Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Null type #16

Closed
40thieves opened this issue Apr 23, 2015 · 5 comments
Closed

Null type #16

40thieves opened this issue Apr 23, 2015 · 5 comments

Comments

@40thieves
Copy link

It'd be useful to have a null type. I'm using apiCheck for HTTP response testing (and it's great, thanks 😄) and some of my responses can be null.

Here's the custom type I'm using at the moment to work around it:

let nullType = (val, name, location) => {
  if (val !== null) return apiCheck.utils.getError(name, location, 'null')
}
@kentcdodds
Copy link
Owner

Thanks for posting this issue. It's something I've been meaning to include. I have a few extra types that I think we need that I have in my own project. Like null, emptyObject, and range :-) If you have any other suggestions I'd love that.

@40thieves
Copy link
Author

👍 for all of those.

The only other thing I thought of was a shortcut for values which can have a type or can be null. Maybe nullable?

kentcdodds pushed a commit that referenced this issue Apr 24, 2015
kentcdodds pushed a commit that referenced this issue Apr 24, 2015
@kentcdodds
Copy link
Owner

You've got everything you asked for and more in 7.1.0 :-) still gotta update the docs. But if you have any questions you can consult the tests!

@kentcdodds
Copy link
Owner

Or, feel free to ask me of course :-)

@40thieves
Copy link
Author

Awesome! Thanks a lot 😄 I'm upgrading now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants