Skip to content

JSDoc (TSDoc ???) is not shown for object literal properties on hover #4677

Description

@nazmul-nhb

Extension Version

0.20260708.2

VS Code Version

1.129.1

Operating system Version

Linux (Pop!_OS 24.04 LTS, Kernel: 7.0.11-76070011-generic)

Steps to reproduce

  1. Create an exported object with documented properties.

    export const HTTP_STATUS = {
      /**
       * The request succeeded.
       */
      OK: 200,
    
      /**
       * A new resource was created.
       */
      CREATED: 201,
    } as const;

    Or use the generated declaration:

    declare const HTTP_STATUS: Readonly<{
      /**
       * The request succeeded.
       */
      readonly OK: 200;
    
      /**
       * A new resource was created.
       */
      readonly CREATED: 201;
    }>;
  2. Import the object in another file:

    import { HTTP_STATUS } from "./status";
    
    HTTP_STATUS.OK;

    Hover over OK (or trigger IntelliSense completion).

Issue

With TypeScript 7, VS Code only displays the type (200) and does not show the JSDoc attached to the object property.

The same code works correctly with TypeScript 6, where hovering over HTTP_STATUS.OK displays the property's documentation.

The JSDoc is present both in the source .ts file and in the generated declaration (.d.ts/.d.mts/.d.cts), so it appears the language service is no longer associating property documentation with object literal members. This regression makes libraries that document enum-like as const objects lose all per-property hover documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: EditorRelated to the LSP server, editor experience

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions