DEV Community

Discussion on: TypeScript?.. or JavaScript?

f1lt3r profile image
Alistair MacDonald Author • Edited

Make sense. TS hinting is pretty great. Hinting tends to drive me nuts, but it is really useful in a larger/unfamiliar codebases. VS Code has some level of hinting for regular JavaScript. I find that I am still able to traverse the model to a satisfying degree (see image).

VS Code Hinting, Traversal, Peeking in Vanilla JS Projects

Thread Thread
dotintegral profile image
Artur Siery • Edited

JS Hinting is great, but it can only go as far as to the code/objects that you explicitly define. There is no way (unless I missed something) for VS Code to predict the structure of data incoming from API. With TS, you can just state that you expect data of this structure and hinting will work correctly. Granted, there is still possibility that you made mistake in typing the response, or the response changes after some time, but the same problems would occur in normal JS.