Re:Functions and algorithms implemented purely with TypeScri...
by ncallaway on Wednesday July 05, 2023 @10:30AM
(#36600972)
If you’re taking in data from
an external source that needs to be validated, I highly recommend a schema library like zod, that can produce a typescript type.
That way you can define the type in a single place, have runtime validation for that type, but also be able to use the type in typescript at compile time.
That way you can define the type in a single place, have runtime validation for that type, but also be able to use the type in typescript at compile time.