Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’ve found TypeScript errors can be made a lot easier to understand with some forethought about how invalid types are defined in the first place. For instance, a many-branched conditional type may be much easier to understand (both as a library user and as a reviewer/maintainer of the library code itself) if each `never` (or whatever actual failure case) is instead a string literal describing the nature of the failure. And better still if it can be templated with an aspect of the input type to highlight what aspect of it triggered the error.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: