jsdoc hyphen in object key

Viewed 354

An object is returned from an API which contains hyphen. I am having trouble documenting this with JSDoc in VS Code. In VS Code JSDoc, the hyphen and everything after the hyphen is the ignored. I have tried Object.<string, string> as well.

/**
 * @typedef MyAPIResponse
 * @type {object}
 *
 * @property {string} X-Request-Id
 * @property {string} X-Correlation-Id
 */
1 Answers

Resolved by using TypeScript declarations and triple slash directive.

Since I'm not using TypeScript in the project, I did the following:

  1. Create a folder for types
  2. Add triple slash directive to JavaScript file. Example: <reference path="./types/my-model.d.ts" /> or use jsconfig.json
Related