Hacker News new | ask | show | jobs
by fenomas 1065 days ago
Huh. I've been doing JSDoc typing, described halfway into TFA, for 2-3 years now but I didn't know it had a name or was considered a thing. Generally I've been really happy with it - no transpilation step to think about, and I get almost all the type hints and errors/warning I'd get from writing TS. And for very little verbosity - I probably only have 2-3 JSDoc comments (that declare types) in each typical .js file.

The main drawback I've fought with is that when you're doing something complicated - e.g. extending or decorating a module imported from elsewhere - it can be hairy to convince the editor to infer what's happening. The other one is I've never found a good way to author an event emitter, such that you get inference and type checks on code subscribing to the events. But there could be solutions to both points that I've been missing.