Re:TypeScript’s quirks: How inconsistencies make the languag...
by nojvek on Friday January 31, 2020 @09:50PM
(#22208283)
Why would casting hide errors?
[ Parent
| on HN ]
Re:TypeScript’s quirks: How inconsistencies make the languag...
by IggleSniggle on Saturday February 01, 2020 @03:04AM
(#22209357)
In the simple case, if it could be Dog|Cat and you cast as Dog but you get a Cat, and TS could have told you about the error if it hadn't been forced to treat it as Dog. This can be fixed by having your types be derived by runtime validation.