π 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.)
π Expected behavior
Documentation should be merged from both definitions of it, like it has in prior versions (such as 6.0.3).
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.
π Search Terms
jsdoc intersection, documentation on intersected properties, documentation merge, jsdoc merge
π Version & Regression Information
β― 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
π 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.propshows no documentation on hover.)π Expected behavior
Documentation should be merged from both definitions of it, like it has in prior versions (such as 6.0.3).
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.