Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsdoc-import-typedef

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdoc-import-typedef

An API documentation generator for JavaScript.

  • 4.0.0-dev
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33
increased by6.45%
Maintainers
1
Weekly downloads
 
Created
Source

jsdoc-import-typedef

This is a fork of jsdoc to deal with typescript type check import way - https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#import-types

Motivation

There are some issues in jsdoc related to this problem and a feature is open here: https://github.com/jsdoc/jsdoc/issues/1645. But the feature will be very complex and maybe can take some time to be done. And I need this fix asap.

Cause

jsdoc uses catharsis to parse the expressions and catharsis.parse doesn't accept the typescript import expression (ex: @param p { import("./a").Pet }).

This raises Invalid type expression like seem here https://github.com/hegemonic/catharsis/blob/master/bin/parse.js#L48

Instead of patch catharsis, I apply the fix in jsdoc, using a regexp to remove this pattern before the string is parsed by catharsis.parse.

In this case, @param p { import("./a").Pet } will be interpreted like @param p { Pet } in jsdoc.

Works great if you are using Typescript to type check your jsdoc - (https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html) and is compatible with all jsdoc templates.

Installation

npm install jsdoc-import-typedef

Usage

This is a patched jsdoc and all its usage remains the same (https://github.com/jsdoc/jsdoc#installation-and-usage).

For more information

License

JSDoc is copyright (c) 2011-present Michael Mathews micmath@gmail.com and the contributors to JSDoc.

JSDoc is free software, licensed under the Apache License, Version 2.0. See the LICENSE file for more details.

Keywords

FAQs

Package last updated on 26 Jul 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc