documentationjs / documentationjs/documentation
Cannot use "require" within @example in TypeScript files
- Dominant language
- JavaScript
- Stars
- 5.8k
- Forks
- 481
- PR merge metrics
- No merged PRs in 30d
Description
**If you're reporting a bug, please include _input code_, _output documentation_,
a description of what you expected to happen, and what happened instead.**
* What version of documentation.js are you using?: 12.0.3
* How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): CLI
I've attached a repo that reproduces what I'm seeing. I have a function written in TypeScript that includes an `@example` call in the JSDoc comment. But the only way I can get it to successfully parse (without throwing an error) is if I use `import ... from ...`, not `require()`. I don't believe this is an issue when parsing JavaScript. Maybe the TypeScript parser does not understand `require`, but I'm wanting to document how to use my library in **Node.js** (so with `require()`), not **TypeScript-parsed JavaScript**. 😬
The example repo: https://github.com/rdmurphy/documentation-typescript-require
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.