ts文件和jsdoc中Typescript的不同行为
Typescript和jsdoc中的Typescript的不同重写行为。我想我做错了什么。关于jsdoc中的Typescriptin,文档中没有太多信息。见下面的例子 打字稿版本:3.5.3 .tsconfig.jsonts文件和jsdoc中Typescript的不同行为,typescript,jsdoc,Typescript,Jsdoc,Typescript和jsdoc中的Typescript的不同重写行为。我想我做错了什么。关于jsdoc中的Typescriptin,文档中没有太多信息。见下面的例子 打字稿版本:3.5.3 .tsconfig.json { "compilerOptions": { "target": "ES2017", "module": "commonjs", "lib": ["es2017", "dom"], "allowJs": true, "checkJs"
{
"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文件中的typescript无效
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中没有任何含义,使用对象,而不是大写字母“O”对象,在typescript中没有任何含义,使用对象,而不是大写字母“O”实际上对象
是typescript中的一种类型。实际上对象
是typescript中的一种类型。