Echo JS 0.11.0

<~>
lorefnon 2293 days ago. link parent 1 point
Library authors would often use prop-types in addition to typescript so that library users who are not using typescript will get runtime warnings when incorrect types are used. 

Also prop-types support adhoc runtime validations which can't be done through typescript at compile time. I have, for example, used this feature to reuse mongoose schema validations in client side in past.

Of course keeping equivalent prop-types and typescript/flow types in sync in a large project is a pain. 

An interesting alternative here is prop-types-ts [1] package by the same author [2] which uses io-ts [3] to unify runtime and compile time type checking.

[1] https://github.com/gcanti/prop-types-ts
[2] https://github.com/gcanti
[3] https://github.com/gcanti/io-ts

Replies