TypeScript Version: 4.1.1-rc
Search Terms: jsdoc declaration constructor super class
Code
export class Super {
/**
* @param {string} firstArg
* @param {string} secondArg
*/
constructor(firstArg, secondArg) {}
}
export class Sub extends Super {
constructor() {
super('first', 'second');
}
}
Expected behavior:
The generated declaration is:
export class Super {
/**
* @param {string} firstArg
* @param {string} secondArg
*/
constructor(firstArg: string, secondArg: string);
}
export class Sub extends Super {
constructor();
}
Actual behavior:
export class Super {
/**
* @param {string} firstArg
* @param {string} secondArg
*/
constructor(firstArg: string, secondArg: string);
}
export class Sub extends Super {
}
This causes problems when using composite projects, where the .d.ts files are used to perform compilations. When the .d.ts is used which omits the child constructor, the compilation will error with:
error TS2554: Expected 2 arguments, but got 0.
Playground Link: https://www.typescriptlang.org/play?useJavaScript=true#code/KYDwDg9gTgLgBAYwDYEMDOa4GUCuZhRwDeAUHHAPQBUVZ5VcAAmClCgLbFoxQCWAdgHMAvnABmvKNwCCUQXTgNmrDlx4CRcNMAQR+AE1nzyiinV39uUHAhjQAFBKkwjAGi069huQEpiwkgCSUEhYRFQMbBwAIzhQGGADTFx8QlJyCysbOyh7P3STNDwCewByJ25S91LtC31SnwBuOgDhIA
Related Issues: n/a
TypeScript Version: 4.1.1-rc
Search Terms: jsdoc declaration constructor super class
Code
Expected behavior:
The generated declaration is:
Actual behavior:
This causes problems when using
compositeprojects, where the.d.tsfiles are used to perform compilations. When the.d.tsis used which omits the child constructor, the compilation will error with:Playground Link: https://www.typescriptlang.org/play?useJavaScript=true#code/KYDwDg9gTgLgBAYwDYEMDOa4GUCuZhRwDeAUHHAPQBUVZ5VcAAmClCgLbFoxQCWAdgHMAvnABmvKNwCCUQXTgNmrDlx4CRcNMAQR+AE1nzyiinV39uUHAhjQAFBKkwjAGi069huQEpiwkgCSUEhYRFQMbBwAIzhQGGADTFx8QlJyCysbOyh7P3STNDwCewByJ25S91LtC31SnwBuOgDhIA
Related Issues: n/a