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

You need to parse and/or validate any external input before you declare that a variable or field is a certain type, as you probably should be doing without Typescript anyway. Being strict in what you accept and ensuring that you're not lying to the type checker solves the vast majority of these types of issues.

It's been a few years since I worked with TS professionally, but at least at the time, I saw it as 95% value, 5% BS. It provides such plainly obvious value in my eyes that I've decided I'll never write JS again unless it's a single file script or a small throwaway project/PoC.



In my experience, even the one file scripts eventually get converted to Typescript when I realize I cannot specify my types :)




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

Search: