tcomb
tcomb copied to clipboard
defaultProps support for t.interface
Version
3.2.20
Expected behaviour
t.interface to support defaultProps like t.struct does.
Actual behaviour
t.interface does not support defaultProps.
Steps to reproduce
const Wearable = t.interface({
wearable: t.Boolean
}, {
name: 'Wearable',
defaultProps: {
wearable: true
}
});
const wearable = new Wearable({});
Stack trace and console log
Uncaught TypeError: [tcomb] Invalid value undefined supplied to Wearable/wearable: Boolean
defaultProps support for structs was added in this commit.