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

Can happen with TypeScript too. There is no runtime type checking so if you parsed a JSON object and cast some unknown property `const result = someRemoteObject.someUnknownPropertyWhichIsAString as number`, it doesn't guarantee that the result is actually a number. You still need to do actual schema validation just like with old school JavaScript.


Better languages solve this. In haskell you define a datatype for json before you parse it.




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

Search: