Skip to content

JSDoc disappears after compilation #48305

@xiaoxiangmoe

Description

@xiaoxiangmoe
Contributor

Bug Report

🔎 Search Terms

JSDoc

🕗 Version & Regression Information

typescript version 4.7.0-dev.20220316

💻 Code

// file: src/symbol.ts
export const sym1 = Symbol()
export const sym2 = Symbol()
// file: src/export.ts

import { sym1, sym2 } from './symbol';

/** # Comments for namedExport */
export const namedExport = [sym1] as const;

/** # Comments for defaultExport */
export default [sym2] as const;
// file: src/import.ts
import defaultExport, { namedExport } from './export';

export { defaultExport, namedExport };

In ts source code, it works well.

image

image


If I build it by tsc:

// file: types/symbol.d.ts
export declare const sym1: unique symbol;
export declare const sym2: unique symbol;
// file: types/export.d.ts
import { sym1, sym2 } from './symbol';
/** # Comments for namedExport */
export declare const namedExport: readonly [typeof sym1];
declare const _default: readonly [typeof sym2];
/** # Comments for defaultExport */
export default _default;
// file: types/import.d.ts
import defaultExport, { namedExport } from './export';
export { defaultExport, namedExport };

image

image

JSDoc of defaultExport disappeared.


This feature is import for vue users. Because most of .vue file use export default defineComponent({});.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @RyanCavanaugh@xiaoxiangmoe

      Issue actions

        JSDoc disappears after compilation · Issue #48305 · microsoft/TypeScript