TypeDoc不理解TypeScript静态块。静态块被添加到TypeScript 4.4中。我使用的是TypeDoc 0.22.17,它声称支持TypeScript Version4.0到4.7 https://typedoc.org/guides/installation/
为了让TypeDoc理解TypeScript中的静态块,还有什么需要做的吗?
例如,这里是文件"src/hello.js":
/**
* My class
*/
export class HelloWorld {
constructor() {
console.log("Hello World");
}
static {
new HelloWorld();
}
}..。和"tsconfig.json":
{
"compilerOptions": {
"module": "ES2020",
"target": "ES6",
"sourceMap": true,
"outDir": "build",
},
"include": [
"src/**/*"
],
}当我运行"npx -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 }发布于 2022-06-26 17:06:38
正如Gerrit0所写的,您需要检查TypeDoc的版本是否与预期的一样,TypeDoc的TypeScript版本也与预期的一样。命令"npx typedoc -version“打印这两个版本。
https://stackoverflow.com/questions/72611540
复制相似问题