简体   繁体   English

使用原始jsdoc注释生成Typescript .d.ts文件?

[英]Generate Typescript .d.ts file with original jsdoc comments?

Context : Typescript 1.5 beta Webstorm 10 上下文:Typescript 1.5 beta Webstorm 10

I'm currently developping two separated projects in TS, one library and one project that will use that library. 我目前正在TS中开发两个独立的项目,一个库和一个将使用该库的项目。

When I am coding inside the library project, the written jsdoc is perfectly understood by Webstorm and CTRL+Q displays it correctly. 当我在库项目中编码时,Webstorm完全理解写入的jsdoc,并且CTRL + Q正确显示它。

Then I compile the library (one single big output file), generate the .d.ts file along the way, and try to use it in the other project : no more documentation available when I'm invoking CTRL+Q. 然后我编译库(一个单独的大输出文件),沿途生成.d.ts文件,并尝试在另一个项目中使用它:当我调用CTRL + Q时,没有更多文档可用。

After investigation, I see that the JSDOC is still present in the generated javascript, but it is not in the .d.ts file - so Webstorm consider there is none. 经过调查,我发现JSDOC仍然存在于生成的javascript中,但它不在.d.ts文件中 - 所以Webstorm认为没有。

So my question is : how can I specify at .d.ts generation time that I want my jsdoc to be included in it ? 所以我的问题是:如何在.d.ts生成时指定我希望将jsdoc包含在其中? Just spent several hours on the net running in circles... 刚刚在网上跑了几个小时......

--edit : my tsconfig file -- --edit:我的tsconfig文件 -

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "noImplicitAny": false,
    "removeComments": false,
    "declaration":true,
    "noLib": false,
    "out": "./dist/myLib.es5.js",
    "sourceMap": true
  }
}

== EDIT FINAL == ==编辑最终==

Ok, the documentation finally appeared in the .d.ts ... A compiler bug, or maybe a chair-keyboard one ... 好的,文档最终出现在.d.ts ...一个编译器错误,或者可能是一个椅子键盘...

So it obviously should works when "removeComments" is set to false ! 因此,当“removeComments”设置为false时,它显然应该可行!

用注释编译即将removeComments编译器标志设置为false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM