The difference in override behavior between Typescript and Typescript in jsdoc is confusing me. I suspect that I may have made a mistake. The documentation on Typescript in jsdoc is quite limited. Refer to the example below.
Typescript version: 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"
]
}
Valid Typescript in js file
class A {
/**
* @param {number} a
* @returns {string}
*/
apply(a) {
return "";
}
}
/**
* @extends {A}
*/
class B extends A {
/**
* @param {object} a
* @returns {string}
*/
apply(a) {
return "";
}
}
Invalid Typescript in ts file
class A {
apply(a: number): string {
return "";
}
}
class E extends A {
apply(some: object) { // encountering error here due to different function signature
return "";
}
}
Expect the same error in A.js