Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
jsdoc-plugin-typescript
Advanced tools
Plugin to make TypeScript's JSDoc type annotations work with JSDoc
Plugin to make TypeScript's JSDoc type annotations work with JSDoc. Requires JSDoc v3.6.0 or higher.
JSDoc accepts plugins by simply installing their npm package:
npm install --save-dev jsdoc-plugin-typescript
To configure JSDoc to use the plugin, add the following to the JSDoc configuration file, e.g. conf.json
:
"plugins": [
"jsdoc-plugin-typescript"
],
See http://usejsdoc.org/about-configuring-jsdoc.html for more details on how to configure JSDoc.
When using the class
keyword for defining classes (required by TypeScript), JSDoc requires @classdesc
and @extends
annotations. With this plugin, no @classdesc
and @extends
annotations are needed.
Types defined in a project are converted to JSDoc module paths, so they can be documented and linked properly.
In addition to types that are used in the same file that they are defined in, imported types are also supported.
TypeScript and JSDoc use a different syntax for imported types. This plugin converts the TypeScript types so JSDoc can handle them:
/**
* @type {import("./path/to/module").exportName}
*/
To:
/**
* @type {module:path/to/module.exportName}
*/
/**
* @type {import("./path/to/module").default}
*/
To:
/**
* @type {module:path/to/module}
*/
When assigned to a variable in the exporting module:
/**
* @type {module:path/to/module~variableOfDefaultExport}
*/
This syntax is also used when referring to types of @typedef
s and @enum
s.
@link
tags/**
* {@link Identifier}
*/
/**
* {@link Identifier Link text}
*/
/**
* {@link Identifier.member}
*/
To:
/**
* {@link module:path/to/module.Identifier Identifier}
*/
/**
* {@link module:path/to/module.Identifier Link text}
*/
/**
* Member accessors are not currently linked to, just the root identifier:
* {@link module:path/to/module.Identifier Identifier.member}
*/
typeof type
/**
* @type {typeof import("./path/to/module").exportName}
*/
To:
/**
* @type {Class<module:path/to/module.exportName>}
*/
/**
* @type {`static:${dynamic}`}
*/
To:
/**
* @type {'static:${dynamic}'}
*/
are removed because they make JSDoc stop inheritance
/**
* @type {{a: number; b: string;}}
*/
To:
/**
* @type {{a: number, b: string}}
*/
Also removes trailing commas from object types.
/**
* @type {(a: number, b: string) => void}
*/
To:
/**
* @type {function(): void}
*/
/**
* @type {obj['key']}
*/
To:
/**
* @type {obj.key}
*/
/**
* @type {[string, number]}
*/
To:
/**
* @type {Array}
*/
For resolving module ids, this plugin mirrors the method used by JSDoc:
@module
tag.If you are interested in making a contribution to the project, please see the contributing page for details on getting your development environment set up.
FAQs
Plugin to make TypeScript's JSDoc type annotations work with JSDoc
The npm package jsdoc-plugin-typescript receives a total of 7,699 weekly downloads. As such, jsdoc-plugin-typescript popularity was classified as popular.
We found that jsdoc-plugin-typescript demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.