0

I am trying to add intellisense comments that can be parsed by Typescript and other linters like prettier. How do I get Prettier, ESLint, or Typescript types to be seen by JSDoc style comments?

If I just use the clear(s, e) function directly I am able to see the linter comments. But when I use the linter type for an array object function like [].clear(s, e) the linter or types intellisense is not shown - (due to usage inside object.defineproperty)

/**
 *
 * clear(start, end)
 * 
 * @param {*} start
 * @param {*} end
 * @return {*} 
 *
 */
function clear(start, end) {
    this.length = 0;
    return this;
}
Object.defineProperty(Array.prototype, 'clear', { value: clear, enumerable: true, });
Gary
  • 2,293
  • 2
  • 25
  • 47

0 Answers0