DEV Community


Discussion on: Notes on TypeScript: Inferring React PropTypes

eriksjaastad profile image
Erik Sjaastad

It turns out that forwardRef was just another one of the issues. If you add a method to the name prop like name.toUpperCase() TS will argue that the value can be null even when you give it the default value and it doesn't complain when implementing <DisplayName />. This describes the issue in stateless functions with defaultProps. It doesn't look like this has really been solved.
Hotell's solution does work thought

Thread Thread
busypeoples profile image
A. Sharif Author

Thanks for the clarification!