React PropTypes are dead to me


React PropTypes are dead to me.

PropTypes:
❌ Checks at run-time
❌ React-specific
❌ No refactor protection
❌ Flakey autocomplete (plugins/patterns req'd)

TypeScript:
✅ Checks at compile-time
✅ Not React-specific
✅ Safe refactoring
✅ Great autocomplete

#typescript #react
If I'm working with a codebase that's in JS, I'd switch to TS on the React components just to be able to statically type the component props.

Typing component props is easy.

And I can use `any` on other spots until I have time to improve types elsewhere in the component file.

View original on X