3 ms·
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 Type
by SlySherZ 9y 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/ http://usejsdoc.org/
- Karunamon 9y agoThis is more what I was looking for; the others appear to be supersets of JS.