Skip to content
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

Doc comments not picked up with ES2015 export statement #769

Closed
mcmath opened this issue May 15, 2016 · 3 comments
Closed

Doc comments not picked up with ES2015 export statement #769

mcmath opened this issue May 15, 2016 · 3 comments

Comments

@mcmath
Copy link

mcmath commented May 15, 2016

Tern doesn't seem to pick up the JSDoc comment in the following case:

/**
 * Divides one number by another.
 *
 * @param   {number}  x  Numerator.
 * @param   {number}  y  Denominator.
 * @return  {number}     Quotient.
 */
export function divide(x, y) {
  return x / y;
}

It behaves just as if the comment wasn't there. It recognizes the divide() function as an export,
but it doesn't get the description and type information from the comment.

Oddly, however, the following works fine:

/**
 * Divides one number by another.
 *
 * @param   {number}  x  Numerator.
 * @param   {number}  y  Denominator.
 * @return  {number}     Quotient.
 */
function divide(x, y) {
  return x / y;
}

export {divide};

Is this a bug, or am I missing something?

@marijnh
Copy link
Member

marijnh commented Jun 7, 2016

Fixed in 453f6fd

@marijnh marijnh closed this as completed Jun 7, 2016
@mcmath
Copy link
Author

mcmath commented Jun 7, 2016

@marijnh Thank you very much for this, and for your work on this fantastic project.

@alisd23
Copy link

alisd23 commented Mar 27, 2017

Having the same issue with v0.21.0, except with variable declarations:

The following does not recognise the typing of someString

/** @type {string} */
export let someString;

Yet this does:

/** @type {string} */
let someString;
export someString;

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

3 participants