Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

t.ReactChildren rejects a correctly renderable children #29

Closed
FrancescoCioria opened this issue Jan 28, 2016 · 5 comments
Closed

t.ReactChildren rejects a correctly renderable children #29

FrancescoCioria opened this issue Jan 28, 2016 · 5 comments
Labels

Comments

@FrancescoCioria
Copy link
Contributor

bug-report

t.ReactChildren rejects an Array of Arrays if the last one has one or more t.Nils

how to reproduce

t.ReactChildren.is([ 'hello', [ 'world' ] ]) // ok
t.ReactChildren.is([ 'hello', [ null ] ]) // rejected!

probable cause

this precise problem is caused by t.ReactChildren being recursive with t.ReactChild instead of itself (https://github.com/gcanti/tcomb-react/blob/master/index.js#L135):

ReactChildren = t.irreducible('ReactChildren', function(x) {
  return ReactChild.is(x) || t.list(ReactChild).is(x); // (shouldn't this be t.ReactChildren?)
});
@FrancescoCioria
Copy link
Contributor Author

/cc @ascariandrea

@gcanti gcanti added the bug label Jan 28, 2016
@gcanti
Copy link
Owner

gcanti commented Jan 28, 2016

Hi @FrancescoCioria,

Thanks for reporting.

shouldn't this be t.ReactChildren?

Looks good to me. Would you like to send a PR?

@gcanti
Copy link
Owner

gcanti commented Jan 28, 2016

/cc @jedmao

@FrancescoCioria
Copy link
Contributor Author

@gcanti done. see #30

gcanti added a commit that referenced this issue Jan 28, 2016
@gcanti
Copy link
Owner

gcanti commented Jan 28, 2016

@gcanti gcanti closed this as completed Jan 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants