You can also use jsdoc to ask tools like vs code to run js as typescript and complement your variables with typing information.
I used this recently for a project that couldn't use typescript.
I used this recently for a project that couldn't use typescript.