Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There could be several reasons why JSDoc does not work properly with *.js files generated from *.ts files:

  1. Typing issues - TypeScript has a static type system that adds type annotations to the code. When the TypeScript is compiled to JavaScript, these type annotations are sometimes lost or transformed, making it difficult for JSDoc to infer types correctly.

  2. Code transformations - TypeScript may perform a variety of code transformations such as changing the structure of classes, introducing interfaces, and converting arrow functions to traditional functions. JSDoc may not be able to pick up these transformations, causing issues with documentation generation.

  3. Missing information - TypeScript also provides additional information beyond what JSDoc offers such as type guards, union types, mapped types, and more. JSDoc may not be able to understand these constructs, leading to incomplete or incorrect documentation.

Overall, the difference between TypeScript and JavaScript can make it difficult for JSDoc to accurately generate documentation. It's important to remember that TypeScript is a superset of JavaScript, so generating TypeScript code from JavaScript may not always be straightforward.