简体   繁体   English

使用 typedoc 时如何显示全局 scope?

[英]How do I display the global scope when using typedoc?

I have a JS project where I manually define type declaration files in a separate directory.我有一个 JS 项目,我在一个单独的目录中手动定义类型声明文件。 Previously I was using typedoc v0.19.2 and it generated documentation beautifully, using this typedoc config:以前我使用的是 typedoc v0.19.2,它使用这个 typedoc 配置生成了精美的文档:

{
  "out": "docs",
  "excludeExternals": true,
  "includeDeclarations": true,
  "mode": "file"
}

My type declaration files mostly add type info onto the global scope, like:我的类型声明文件主要将类型信息添加到全局 scope 中,例如:

declare global {
  namespace something {
    ...
  }
}

I'm now using typedoc v0.20.11 and it doesn't seem to be noticing anything on the global scope.我现在正在使用 typedoc v0.20.11,它似乎没有注意到全局 scope 上的任何内容。 I realize there were some major changes in v0.20.0 but was really hoping there would be functional parity buried in here somewhere for this specific use-case (manually defined type declaration directory, where the declarations take advantage of the global scope and aren't necessary declaring new modules).我意识到 v0.20.0 中有一些重大变化,但真的希望在此特定用例的某个地方埋藏功能奇偶性(手动定义的类型声明目录,其中声明利用全局 scope 而不是有必要声明新模块)。 Any guidance would be much appreciated: Here is my current typedoc config (not working):任何指导将不胜感激:这是我当前的 typedoc 配置(不工作):

{
  "out": "docs",
  "excludeExternals": true,
  "entryPoints": ["types/index.d.ts"],
  "tsconfig": "typdoc-tsconfig.json",
  "readme": "none"
}

(have also tried using the "expand" entryPointStrategy with just the "types" directory -> this seems like it makes more sense for my use case, but still doesn't seem to work). (还尝试使用仅带有“types”目录的“expand” entryPointStrategy -> 这似乎对我的用例更有意义,但似乎仍然不起作用)。

and typedoc-tsconfig.json :typedoc-tsconfig.json

{
  "include": ["types"]
}

I solved this issue using a typedoc plugin lib made specifically for this purpose, typedoc-plugin-not-exported .我使用专门为此目的制作的 typedoc 插件库typedoc-plugin-not-exported解决了这个问题。 This flawlessly addresses this exact problem.这完美地解决了这个确切的问题。 Exposing types on the global scope isn't technically export ing them, and so the updated version of typedoc (I'm thinking >=0.20.0) won't include them.在全局 scope 上公开类型在技术上并不export它们,因此 typedoc 的更新版本(我认为 >=0.20.0)不会包含它们。 This plugin library fixes that.这个插件库解决了这个问题。

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

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