4 ms·
Type guard in the example should use runtime type checkers or codec like io-ts (https://github.com/gcanti/io-ts https://github.com/gcanti/io-ts), otherwise it w
by valand 6y ago
Type guard in the example should use runtime type checkers or codec like io-ts (https://github.com/gcanti/io-ts https://github.com/gcanti/io-ts), otherwise it will just become a type-assertion with partial correctness.
With codec, one can make sure that the type is correct and defining type and type-guard becomes a one-time task.