【发布时间】:2019-07-11 16:40:54
【问题描述】:
Typescript 和 jsdoc 中的 Typescript 中的不同覆盖行为。我觉得我做错了什么。关于 Typescriptin jsdoc 的文档中没有太多信息。请参见下面的示例。
打字稿版本:3.5.3
.tsconfig.json
{
"compilerOptions": {
"target": "ES2017",
"module": "commonjs",
"lib": ["es2017", "dom"],
"allowJs": true,
"checkJs": true,
"noEmit": true,
"strict": false,
"noImplicitThis": true,
"alwaysStrict": true,
"esModuleInterop": true
},
"include": [
"*.js",
"*.ts"
]
}
js 文件中的有效打字稿
class A {
/**
* @param {number} a
* @returns {string}
*/
apply(a) {
return "";
}
}
/**
* @extends {A}
*/
class B extends A {
/**
* @param {object} a
* @returns {string}
*/
apply(a) {
return "";
}
}
ts 文件中的打字稿无效
class A {
apply(a: number): string {
return "";
}
}
class E extends A {
apply(some: object) { // got error here as function signature is different
return "";
}
}
预计A.js 中会出现同样的错误
【问题讨论】:
标签: typescript jsdoc