Typescript solves a ton of these problems, but it needs to be compiled into JS, and its rules feel a little constricting at times.
That's why I love JSDoc. JSDoc is a pretty good compromise between JS and Typescript. Essentially you can specify type annotations for function and class parameters in vanilla js, by leaving comments to document them. My IDE supports JSDoc, so it has helped a great deal.
Yeah, that's all.