I didn't see it mentioned, so how do you handle generating type-guards/run-time type validation functions?
Can you elaborate a bit more about what sorts of type-guards and run-time validation functions you're thinking about? The only type-guards we somewhat generate are the ones Redux Toolkit makes for all of its actions, but aside from that, we only really use type guards when we're interfacing with a 3rd party API or something.
So like, if you've got an endpoint that says it returns
interface Foo {
baz: string
bar: number
}
What happens if the endpoint actually sends you '{"bar":"23"}'
? How do you check to make sure the 'unverified' data is actually what you think it is?Or if the db schema has a nullable column but the typescript type for some reason isn't nullable/optional? Or worse, the db query isn't pulling the fields it should be (eg the db schema changed but the typescript definition didn't).