ts2jsdoc
ts2jsdoc copied to clipboard
Undefined for object destructuring
Hi,
Function parameters with object destructuring generates undefined as name. Please see example simplified below. I edited it on the fly while simplifying, it may have some syntax errors:
/**
* Connection configuration interface.
*/
export interface ConnectionConfig {
/** Database name */
database?: string;
/** User name for connecting database */
user?: string;
/** Password for user */
password?: string;
}
/**
* Some description
* @param [config] - Connection object to fill.
* @return - Fully filled connection object.
*/
export function getConnectionObject({
database,
user = "user",
password = "password",
}: ConnectionConfig = {}): ConnectionConfig {
return {
database,
user,
password,
}
}
generates
/**
* Some description
* @param {module:pg-test-util/lib/types/connection-config.ConnectionConfig} undefined
* @returns {module:pg-test-util/lib/types/connection-config.ConnectionConfig}
*/
export function getConnectionObject() {}
expected either
/**
* Some description
* @param {module:pg-test-util/lib/types/connection-config.ConnectionConfig} config
* @returns {module:pg-test-util/lib/types/connection-config.ConnectionConfig}
*/
export function getConnectionObject() {}
or much better as typedoc gets interface details from interface definition:
/**
* Some description
* @param {module:pg-test-util/lib/types/connection-config.ConnectionConfig} config
* @param {string} [config.database] - Database name
* @param {string} [config.user=user] - User name for connecting database
* @param {string} [config.password=password] - Password for user
* @returns {module:pg-test-util/lib/types/connection-config.ConnectionConfig}
*/
export function getConnectionObject() {}