Closed velveteer closed 8 years ago
Hi,
Thanks for your PR.
getInputs()
uses the keys of the object returned by getTypeProps()
as refs, what about?
const props = this.getTypeProps() // <= same implementation of getInputs()
for (const ref in props) {
if (this.refs.hasOwnProperty(ref)) {
....
}
}
Note. Both validate()
and getValue()
should be changed accordingly.
Ah I didn't see getTypeProps()
but I figured it must exist somewhere. Thanks for pointing that out.
@gcanti I think this PR makes sense considering we should only be iterating over known props instead of all possible refs inside of a struct component. Does this look good to you?
Ah, yes. Sorry, I didn't notice your last commit yesterday, going to merge
Released in https://github.com/gcanti/tcomb-form/releases/tag/v0.7.9, thanks @velveteer
This might be heresy, but in one case I have nested refs inside of custom templates. When validating structs it iterates over all refs and will fail to call
validate
on my own refs (which are not tcomb generated components). I am open to other ways of achieving this.