Closed
Description
TypeScript Version: 4.0.0-dev.20200512
Search Terms: jsdoc, declaration, static method
Code
clazz.js
:
export class Clazz {
static method() {}
}
Clazz.method.prop = 5;
tsconfig.json
:
{
"compilerOptions": {
"outDir": "lib",
"declaration": true,
"allowJs": true,
"checkJs": true
},
"files": [
"clazz.js"
]
}
Expected behavior:
The emitted declaration file is:
export class Clazz {
static method(): void;
}
export namespace Clazz {
export namespace method {
export const prop: number;
}
}
Actual behavior:
export class Clazz {
}
Note that if the method is not static, it properly generates the declaration file.
Also, please don't ask me why this is in the DevTools codebase. I only found out that we did when TypeScript started complaining about missing methods even though they were defined. I then spend a long time trying to figure out what the issue was, until I discovered the property assignment. When I changed the property assignment to a normal variable declaration, TS was properly emitting the method again.
Playground Link:
Related Issues: