question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exporting an arrow function won't produce documentation

See original GitHub issue

If I have a module like this:

/**
 * @module formatmicro
 */

/**
 * @param {number} timeMicro
 * @param {object|function} incrementNames
 * @returns {string}
 * @throws {Error} If either argument isn't the correct type
 */
export default (timeMicro, incrementNames) => { }

It won’t produce any documentation. However, if I name the exported function, it will:

/**
 * @module formatmicro
 */

/**
 * @param {number} timeMicro
 * @param {object|function} incrementNames
 * @returns {string}
 * @throws {Error} If either argument isn't the correct type
 */
export default function formatmicro(timeMicro, incrementNames) { }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:5
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
h13i32marucommented, Nov 23, 2015

@cullylarson Hi! Thanks for this issue. I will fix it in future version.

3reactions
shfxcommented, Oct 6, 2016

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to export Arrow functions in ES6/7?
Is it possible to export Arrow functions in ES6/7? Yes. export doesn't care about the value you want to export. The export statement...
Read more >
Directly exporting an (arrow) function prevents it from being ...
When using the export const Var = () => console.log('stuff') , the result code prevents the function from using the name of the...
Read more >
Arrow function expressions - JavaScript - MDN Web Docs
Arrow functions cannot use yield within their body and cannot be created as generator functions. Try it.
Read more >
ES6 Class Mocks - Jest
If you use arrow functions in your classes, they will not be part of the mock. The reason for that is that arrow...
Read more >
export default arrow function | The AI Search Engine You Control
You're trying to export a default and declare a variable at the same time, which is invalid syntax. Consider the following, since we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found