Open PSYmoom opened 2 years ago
We're running into this issue too. A simple enum
example
/**
* The direction enum.
*
* @enum {number}
*/
enum Direction {
/**
* Up direction.
*
* @type {number}
*/
Up = 1,
/**
* Down direction.
*
* @type {number}
*/
Down = 2,
/**
* Left direction.
*
* @type {number}
*/
Left = 3,
/**
* Right direction.
*
* @type {number}
*/
Right = 4,
}
export default Direction;
generates the following output:
export default Direction;
/**
* The direction enum.
*/
type Direction = number;
declare namespace Direction {
const Up: number;
const Down: number;
const Left: number;
const Right: number;
}
This problem is still occurring. Is there no work scheduled for this?
// js source
/**
* default
* @param {number} param
*/
export default param => {
/**
* default.result
* @param {string} p
*/
const result = p => p + p
/**
* default.result.fn
*/
result.fn = () => {}
return result
}
// generated d.ts
declare function _default(param: number): {
(p: string): string;
/**
* default.result.fn
*/
fn(): void;
};
export default _default;
Bug Report
I am currently trying to autogenerate .d.ts files for my JavaScript API using --declaration and I am running into problems. All of the files which use a const namespace will have all of their comments removed, including the JSDocs ones. I have set
removeComments
as false in tsconfig and sanity checked it by a class with comments and all of the comments were retained in the class, but not the namespace.π Search Terms
Duplicate methods --declaration namespace .d.ts bug
π Version & Regression Information
4.4.3
but happens with any4.x.x
version I've tried (haven't tried earlier versions).β― Playground Link
The Playground was not playing nicely with emitDeclaration and filenames with .js extension
π» Code
π Actual behavior
π Expected behavior