Skip to content

Behavior difference: Comment above @typedef does not become comment for the corresponding emitted type in tsgo #4363

Description

@hkleungai

Another follow-up on #4235.


Steps to reproduce

  1. Start a plain new project
    • "@typescript/native-preview": "7.0.0-dev.20260618.1",
    • "typescript": "6.0.3"
  2. Run npx tsgo --init to get the default tsconfig. Turn on these flags as well.
    • "allowJs": true,
    • "checkJs": true,
    • "stableTypeOrdering": true,
  3. Add src/main.js. Run npx tsc & npx tsgo to see the difference.
/**
 * Comment on the `Foo` type
 *
 * @typedef {Object} Foo
 * @property {boolean} bool Whether `.bool` is true or not
 */

Behavior with typescript@6.0

/**
 * Comment on the `Foo` type
 */
export type Foo = {
    /**
     * Whether `.bool` is true or not
     */
    bool: boolean;
};

Behavior with tsgo

export type Foo = {
    /**
     * Whether `.bool` is true or not
     */
    bool: boolean;
};
/**
 * Comment on the `Foo` type
 *
 * @typedef {Object} Foo
 * @property {boolean} bool Whether `.bool` is true or not
 */

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions