DEV Community

Discussion on: Cool stuff with Typescript

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Using comments with Types

And then you suddenly realize that you can can put TypeScript types in JSDoc as well, that is *.js. (and interfaces are possible with @typedef)

// @ts-check

/**
 * @type {HTMLTextAreaElement}
 */
// @ts-ignore
const editorEl = document.getElementById('editor')

But it cannot really replace everything. TypeScript is a lock-in game.

Collapse
 
aminejvm profile image
Amine

Personally I haven't worked with JSDoc, but it seems interesting I will give it try.