Ask Your Question
0

What is the reason for jsdoc not working properly with *.js files that were generated from *.ts files?

asked 2021-09-01 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-11-13 17:00:00 +0000

qstack gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-09-01 11:00:00 +0000

Seen: 13 times

Last updated: Nov 13 '21