Skip to content

JSDoc not retained across default re-export #41216

@wereHamster

Description

@wereHamster

JSDoc is lost when an identifier is re-exported using export { default as X } from …. Consider the example below

// File: mod-a.ts

/**
 * Some jsdoc here.
 */
export default = 42
/* ^^^ jsdoc works over the `default` keyword */
// File: mod-b.ts

export { default as fortytwo } from './mod-a'
/* ^^^ jsdoc works over the `default` keyword, but not over the `fortytwo` keyword */
// File: mod-c.ts

import { fortytwo } from './mod-b'
console.log(fortytwo)
/* ^^^ no jsdoc available for `fortytwo` */

A workaround is to modify file mod-a.ts like this:

// File: mod-a.ts

/**
 * Some jsdoc here.
 */
const fortytwo = 42
export default fortytwo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions