Hacker News new | ask | show | jobs
by SlySherZ 3000 days ago
Yes, there is JSDoc[1] which allows you to add type annotations in comments, that can then be used by some tool.

The VSCode editor is able to leverage the TypeScript engine even with vanilla JS to automatically infer types and also supports JSDoc. Basically you write vanilla JS, add JSDoc comments here and there when the inference doesn't work as you want and it gives you most benefits of a typed language, without tying yourself to a specific ecosystem (your teammates could be using something else entirely). It works pretty well.

[1] http://usejsdoc.org/

1 comments

This is more what I was looking for; the others appear to be supersets of JS.