Closed anelook closed 3 years ago
We should not ignore zero value when generating code for a property of type Number.
Can be reproduce in https://codesandbox.io/s/i3dbn?fontsize=14&hidenavigation=1&theme=dark by adding
importantProperty: { type:PropTypes.Number, value: 0, defaultValue: undefined, description: 'Do not ignore me!' }
When changing value from '0' to '1', the code generator works as expected. However, when value is set to '0', code generator ignores 'importantProperty'.
Underlying issue: At the moment it is treated as boolean and code-generator return Null for
getAstPropsArray( { a: { value: 0, defaultValue: undefined, type: PropTypes.Number, description: '', }, }, {} )[0]
Hi Vojtech, are there any concerns for this change? I see that only code review is pending :)
lgtm, thanks!
We should not ignore zero value when generating code for a property of type Number.
Can be reproduce in https://codesandbox.io/s/i3dbn?fontsize=14&hidenavigation=1&theme=dark by adding
When changing value from '0' to '1', the code generator works as expected. However, when value is set to '0', code generator ignores 'importantProperty'.
Underlying issue: At the moment it is treated as boolean and code-generator return Null for