allow then, andThen, catch, andCatch to be undefined#128
allow then, andThen, catch, andCatch to be undefined#128ryanbrainard merged 2 commits intoheroku:masterfrom
Conversation
| Array.isArray(types) | ||
| ? types.some(t => typeof obj === t) | ||
| : typeof obj === types, | ||
| `${name} must be a ${types}. Instead received a %s.`, |
There was a problem hiding this comment.
This message will be weird if ${types} is an array. Probably need to do some joining. Also, it might be easier to convert types to an Array before the invariant to avoid having two special cases in here.
There was a problem hiding this comment.
actually I tested it and an array is coerced to a string correctly, eg.
arr = ['function', 'undefined']
str = `then must be a ${arr}`str will be then must be a function, undefined which is pretty clear but when types is an array I can replace a with one of so that it becomes then must be one of function, undefined, should I do that?
There was a problem hiding this comment.
yeah, it would probably read better that way. (Of course this really isn't super important since it is only something shown in the dev console...)
|
Looks like the test needs to be updated. |
|
fixed now |
|
Thanks! |
|
@ryanbrainard could you cut a release with this? |
|
@nfcampos oh, sure, sorry I didn't already |
|
@ryanbrainard Thanks! |
typecheckfunction to support more than on allowed typetypecheckChecktest function to support more than one allowed type