Skip to content

JSDoc for properties of intersected types is no longer mergedΒ #63640

Description

@theblueplum

πŸ”Ž Search Terms

jsdoc intersection, documentation on intersected properties, documentation merge, jsdoc merge

πŸ•— Version & Regression Information

  • This changed between versions 6.0.3 and 7.0.2

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=6.0.0-dev.20260416&ssl=19&ssc=17&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgILIN4EgCwAoLAegCpj8tljlRJZEVVzLDyAHKAe1YC5kAKAJTIAvAD5kIAK4BbAEbQA3PgC++fDWjwkyAEKZyJMgUrVwm+rqbEWBdl16CR4qXMUq1eMAE9WKAMIiaMgAZLpKeAAmEAgANnBQKAgcIADOYMgIvH7h+AgAdHas4YSEyAB6ZcgAEhwAbtDIYAAWwClAA

πŸ’» Code

interface A {	
	/**
	 * interface A
	 */
	prop: () => number;
}

interface B {
	/**
	 * interface B
	 */
	prop: () => number;
}

type C = A & B;
declare const c: C;

c.prop;
// ^^ Hover this

πŸ™ Actual behavior

In versions 6 and earlier, the hover documentation of a property defined in two or more types of an intersection was merged from all the types.

In version 7, this behavior no longer seems to apply, as overlapping definitions of the same property just lead to the property not having any documentation within the intersection. (For example, with the code snippet above, c.prop shows no documentation on hover.)

Image

πŸ™‚ Expected behavior

Documentation should be merged from both definitions of it, like it has in prior versions (such as 6.0.3).

Image

I believe this is a convenient feature to have, as it allows one to document the methods of a base interface, and inheritors of that interface then to document additional clauses or invariants of the method implementation.

Additional information about the issue

VSCode version: 1.127.0

There is another seemingly related issue, #30901, which seems to be reporting this behavior as a bug. It is however still open, so I will for now be treating this change in behavior as a regression rather than a bugfix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions