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.
This is why I use codec libraries like zod or io-ts (purify has them built in also) at my boundaries.
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.
That’s what’s class-validator is for. You can ensure your apis are doing sensible things.