Skip to content

JSDoc of base class/interface appears many times when using union of derived class/interface #32708

@AnyhowStep

Description

@AnyhowStep

TypeScript Version: 3.5.1

Search Terms:

JSDoc, duplicate, extends, implements

Code

interface InterfaceFoo<DataT extends { name : string }> {
    /**
     * Some comment
     * 
     * -----
     */
    name : DataT["name"]
}

class ClassFoo<DataT extends { name : string }> implements InterfaceFoo<DataT> {
    name! : DataT["name"]
}

///////////////////////
declare const arr2 : readonly (
    | ClassFoo<{name:"X"}>
    | ClassFoo<{name:"Y"}>
)[];
/*
Expected:
Some comment

Actual:
Some comment
-----
Some comment
-----
*/
arr2[0].name

///////////////////////
declare const arr3 : readonly (
    | ClassFoo<{name:"X"}>
    | ClassFoo<{name:"Y"}>
    | ClassFoo<{name:"Z"}>
)[];

/*
Expected:
Some comment

Actual:
Some comment
-----
Some comment
-----
Some comment
-----
*/
arr3[0].name

Expected behavior:

Some comment should only appear once

Actual behavior:

Some comment appears n times if the array contains ClassFoo<> n times

Playground Link:

Playground

Related Issues:

No idea

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions