[英]TypeDoc fails with static block
TypeDoc does not understand TypeScript static blocks. TypeDoc 不理解 TypeScript 静态块。 Static blocks were added to TypeScript 4.4.静态块被添加到 TypeScript 4.4。 I am using TypeDoc 0.22.17 which claims to support TypeScript versions 4.0 through 4.7 https://typedoc.org/guides/installation/我正在使用 TypeDoc 0.22.17,它声称支持 TypeScript 版本 4.0 到 4.7 https://typedoc.org/guides/installation/
Is there something else I need to do to make TypeDoc understand static blocks in TypeScript?为了让 TypeDoc 理解 TypeScript 中的静态块,我还需要做些什么吗?
For example of problem, here is file "src/hello.js":例如问题,这里是文件“src/hello.js”:
/**
* My class
*/
export class HelloWorld {
constructor() {
console.log("Hello World");
}
static {
new HelloWorld();
}
}
... and "tsconfig.json": ...和“tsconfig.json”:
{
"compilerOptions": {
"module": "ES2020",
"target": "ES6",
"sourceMap": true,
"outDir": "build",
},
"include": [
"src/**/*"
],
}
When I run "npx typedoc -out html src/hello.ts" I get the following error messages:当我运行“npx typedoc -out html src/hello.ts”时,我收到以下错误消息:
Error: src/hello.ts:9:11 - error TS1146: Declaration expected.
9 static {
Error: src/hello.ts:9:12 - error TS1005: ';' expected.
9 static {
~
Error: src/hello.ts:12:1 - error TS1128: Declaration or statement expected.
12 }
As Gerrit0 wrote, you need to check the version of TypeDoc is as expected and TypeDoc's version of TypeScript is as expected too.正如 Gerrit0 所写,您需要检查 TypeDoc 的版本是否符合预期, TypeDoc 的 TypeScript 版本也符合预期。 The command "npx typedoc --version" prints both versions.命令“npx typedoc --version”打印两个版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.