Hacker News new | ask | show | jobs
by robmoorman 2495 days ago
React is already typed with props. I see no added use for TypeScript. Yet another list of packages makes maintaining very hard and inconsistent (as types are declared in variant ways). Explicit (and simple) functions as React (e.g. hooks) provides won't need strongly typed code, less readability in my opinion.

If you're building a library / sdk, than Typescript comes in place and can make life easier for devs.

2 comments

PropTypes are disabled for production builds and runtime only.

The only advantage for using them over TypeScript or Flow that I've seen is when consuming third party React components.

Otherwise the guarantees, feedback loop and terseness of static types are superior to PropTypes.

I don't understand. How would you strongly type every function and state variable in react without typescript?