Skip to content

duplicated exports #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zhenyulin opened this issue Mar 10, 2020 · 1 comment
Closed

duplicated exports #1309

zhenyulin opened this issue Mar 10, 2020 · 1 comment

Comments

@zhenyulin
Copy link

zhenyulin commented Mar 10, 2020

The doc shows duplicated exports on some of the functions(e.g. errorMute), while some of the function written in the same way doesn't have this problem(e.g. eventLogger).

source code can be found here
errorMute
eventLogger

It is probably caused by jsdoc type import

/**
 * @template T
 * @typedef {import('./types').ErrorHookMethod<T>} ErrorHookMethod
 */

If I import directly at the function comment, there is no duplicate but the imported type is not parsed correctly as casted to any even if it is not importing a generic type

/**
 * A decorator to mute errors when conditions are met.
 *
 * @param {object} options - Config.
 * @param  {import('./types').ErrorHookMethod<boolean>} [options.condition] - Condition to mute the error.
 * @returns {Error|object|undefined} - If the error is muted(not thrown to upper level) it is accessible in the return value.
 */

the setup:

  • documentation.js - latest version, ran on CLI with/without --shallow flag
  • jsdoc linted via eslint-plugin-jsdoc with typescript mode enabled
  • implementation style: object destruct assign function parameter with default values
@zhenyulin
Copy link
Author

Update: put the type import and function type comment in one section solves the problem

/**
 * A decorator to mute errors when conditions are met.
 *
 * @template T
 * @typedef {import('./types').ErrorHookMethod<T>} ErrorHookMethod
 *
 * @param {object} options - Config.
 * @param  {ErrorHookMethod<boolean>} [options.condition] - Condition to mute the error.
 * @returns {Error|object|undefined} - If the error is muted(not thrown to upper level) it is accessible in the return value.
 */

Besides @template tag parsing is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant