Imagine you're writing typescript project.
You type everything and have type safety.
This type safety is an illusion on I/O boundaries – whenever ie. JSON.parse(...) from file/websocket/http happens.
To preserve type safety, you want to use something like [0] to do runtime type assertions.
Once i/o boundaries are parsing unknown types at runtime into what is defined as static types, your type safety is guaranteed.
[0] https://github.com/appliedblockchain/assert-combinators