π Search Terms
jsdoc namespace commonjs
π Version & Regression Information
- This changed between versions 3.6 and 3.7 (the first version to support types in JSDoc)
β― Playground Link
https://www.typescriptlang.org/play?ts=5.2.2&filetype=js#code/PQKhCgAIUgBAXAngBwKYBNUDNIHlnwCWA9gHYDOUMsyATsWrUpAN7ny2GkDmAvpA3hVg4cKAjQ4yAIa1pAW1b4iZcv0EkKw8POLoArgBtUAOlQAPZMSblIAXkgAKDaoCU9gHyteAbnBA
π» Code
/**
* @typedef Options
* @property {string} opt
*/
/**
* @param {Options} options
*/
module.exports = function loader(options) {}
π Actual behavior
TypeScript emits the following .t.ds.
declare function _exports(options: Options): void;
export = _exports;
export type Options = {
opt: string;
};
π Expected behavior
I expect the TypeScript to emit the following:
export = loader;
/**
* @typedef Options
* @property {string} opt
*/
/**
* @param {Options} options
*/
declare function loader(options: Options): void;
declare namespace loader {
export { Options };
}
type Options = {
opt: string;
};
Or when the expression is unnamed:
export = _exports;
/**
* @typedef Options
* @property {string} opt
*/
/**
* @param {Options} options
*/
declare function _exports(options: Options): void;
declare namespace _exports {
export { Options };
}
type Options = {
opt: string;
};
Additional information about the issue
I initially noticed this in the output of https://github.com/mdx-js/mdx/blob/3.0.0/packages/loader/index.cjs.
π Search Terms
jsdoc namespace commonjs
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.2.2&filetype=js#code/PQKhCgAIUgBAXAngBwKYBNUDNIHlnwCWA9gHYDOUMsyATsWrUpAN7ny2GkDmAvpA3hVg4cKAjQ4yAIa1pAW1b4iZcv0EkKw8POLoArgBtUAOlQAPZMSblIAXkgAKDaoCU9gHyteAbnBA
π» Code
π Actual behavior
TypeScript emits the following
.t.ds.π Expected behavior
I expect the TypeScript to emit the following:
Or when the expression is unnamed:
Additional information about the issue
I initially noticed this in the output of https://github.com/mdx-js/mdx/blob/3.0.0/packages/loader/index.cjs.