TypeScript type annotations provide compile-time guarantees. However, when data flows into our clients from external sources, many things can go wrong at runtime.
JSON decoders validate our JSON before it enters our program. This way, if the data has an unexpected structure, we're immediately alerted.
TypeScript type annotations provide compile-time guarantees. However, when data flows into our clients from external sources, many things can go wrong at runtime.
JSON decoders validate our JSON before it enters our program. This way, if the data has an unexpected structure, we're immediately alerted.
Example