Hacker News new | ask | show | jobs
by skimdesk 1137 days ago
For smaller applications, an acceptable middle ground is using the TS language server[0] and JSDoc[1] comments.

Writing

  // @ts-check
  /** @type {number} */
  let x;
works very well for example in VSCode. The JSDoc comments are not as convenient as Typescript, but otherwise the experience is almost the same. The language server correctly keeps track of the types for me.

[0]: https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.... [1]: https://jsdoc.app/