Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could make some of the same arguments against prop types - what if you miss them, what if they are incorrect (too narrow).

Regarding third party libraries, with prop types you are effectively writing your own bindings to the parts of those libraries that happen to go through your props, except you fail far away from where the error is produced.

Prop types are also a very ad-hoc solution to a very general problem. Why are props for UI components especially deserving of type checking? What about the rest of your application code? Event your components' state is not worthy of type checking?

With JS or typed-JS languages like Typescript or Flow you will never get full type safety (Flow is better at safety than TS if you're interested). For me the solution is to either go 80% of the way for 20% of the effort with those languages, or go full Scala.js or something that is actually type safe. And the latter has many goodies like https://github.com/lihaoyi/autowire to make API calls typed.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: