3 ms·
Friendly tips: you can replace any with unknown. Other friendly tips: runtime type checks are available https://github.com/gcanti/io-ts https://github.com/gcant
by valand 7y ago
Friendly tips: you can replace any with unknown.
Other friendly tips: runtime type checks are available
https://github.com/gcanti/io-ts https://github.com/gcanti/io-ts
https://github.com/pelotom/runtypes https://github.com/pelotom/runtypes
- sadlion 7y agoCan you please provide more detail when it's best to use runtime type checks? For webapps with strict TS config, I'm failing to see the advantage. Runtime errors can occur when crossing boundaries from server API to UI but when you discover the exceptions, you go fix your contract.
- valand 7y ago1st it's easier to identify which contract is inaccurate, or even whether the contract is inaccurate or not in the first place 2nd it's more convenient for both the end-user and the developers that errors are handled this way