DEV Community

Discussion on: Notes on TypeScript: Inferring React PropTypes

 
busypeoples profile image
A. Sharif

If you add the defaultProps definition to the Text component, it should probably be enough for TypeScript to figure out that the property is optional.

Text.defaultProps = {
  size: 5
};