The objective is to get JSDoc documentation from TypeScript code. The quality of documentation from TypeDoc (TypeScript documentation solution) isn't acceptable because the documentation is targeted at JS users and shouldn't be flooded with the details that are specific to TypeScript implementation (interfaces, etc).
Currently transpiling to ES6 and generating the documentation from JS files does the trick for the most part. Except for the properties that have no assigned values. As it appears,
class A {
/**
* @private
* @var _a
*/
private _a;
/**
* @public
* @var a
*/
public a = true;
}
is being transpiled to
class A {
constructor() {
/**
* @public
* @var a
*/
this.a = true;
}
}
While I would expect something like
class A {
constructor() {
/**
* @private
* @var _a
*/
/**
* @public
* @var a
*/
this.a = true;
}
}
or
class A {
/**
* @private
* @var _a
*/
constructor() {
/**
* @public
* @var a
*/
this.a = true;
}
}
How can comments (particularly JSDoc) be provided for unassigned class members in TypeScript? Is there a trick that could make the comments stay in place (even if private _a;
is absent from transpiled code)?