News for hackers. Stuff that matters.
Re:Postgres Audit Tables Saved Us from Taking Down Production by awoimbee on Saturday August 12, 2023 @02:52PM (#37103100)
Typescript does compile time checking only. Almost all TypeScript programs I've seen just decode JSON received and slap an `as SomethingType`. TypeScript is not strict, so it's easy to write but you can still get type errors.
Re:Postgres Audit Tables Saved Us from Taking Down Production by hinkley on Saturday August 12, 2023 @03:27PM (#37103420)
For instance I am currently trying to file a patch for a TS project. It is advertised as an npm module, which means if you pass a string to a function expecting a number it will happily do string concatenation on it instead of addition. There are no internal checks because TS, but that only works if you call it from TS. Otherwise authors have a false sense of security and make bad decisions.
Re:Postgres Audit Tables Saved Us from Taking Down Production by geraldwhen on Saturday August 12, 2023 @03:18PM (#37103325)
That’s what’s class-validator is for. You can ensure your apis are doing sensible things.
Re:Postgres Audit Tables Saved Us from Taking Down Production by thewix on Saturday August 12, 2023 @05:27PM (#37104388)
This is why I use codec libraries like zod or io-ts (purify has them built in also) at my boundaries.