(Replying to PARENT post)

a common misconception is that TypeScript[TS] will provide runtime safety; it won't unless you specifically add functions for it, like the type casts presented in the article.

The typecast approach presented in the article can be combined with TS to provide runtime type safety; They are not entirely opposite/alternative approaches but complementary.

๐Ÿ‘คHugoDaniel๐Ÿ•‘5y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

Yes, TS and typecasting can live well together. However, once you combine sensible naming by type and typecasting together, the benefits of TS fade. Then one has to ask: are the remaining benefits worth the expense of running a full TS transpiling infrastructure? In my case, the answer is a definitive 'no'. Typecasting along with Webstorm introspection virtually eliminate may of the issues that TS was designed to solve.
๐Ÿ‘คdepmann๐Ÿ•‘5y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

There's a library called runtypes (https://github.com/pelotom/runtypes) that integrates TS and Typecasting quite nicely
๐Ÿ‘คwilliamdclt๐Ÿ•‘5y๐Ÿ”ผ0๐Ÿ—จ๏ธ0