microsoft / microsoft/TypeScript
JSDoc comments emitted a second time even after commenrs on type are emitted
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
### 🔎 Search Terms
JSDoc, emit, comments
### 🕗 Version & Regression Information
v5.9.2
- I was unable to test this on prior versions because I was not using TS.
### ⏯ Playground Link
_No response_
### 💻 Code
```js
/**
* The template passed to generate messages
*
* @callback Template
* @param {...*} args - Arguments to the template
* @returns {any} The generated message
*/
/**
* The arguments sent with notify become the input parameters for the template.
*
* @typedef {Parameters} TemplateParams
*/
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*
* @typedef {ReturnType} Message
*/
```
### 🙁 Actual behavior
Typescript, when emitting from JSDoc, seems to want to emit the same comments for a type declaration twice:
+ once for the export (good) and
+ once just copying over the JSDoc comment (bad).
```ts
/**
* The template passed to generate messages
*/
export type Template = (...args: any[]) => any;
/**
* The arguments sent with notify become the input parameters for the template.
*/
export type TemplateParams = Parameters;
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*/
export type Message = ReturnType;
/**
* The template passed to generate messages
*
* @callback Template
* @param {...*} args Arguments to the template
* @returns {any} The generated message
*/
/**
* The arguments sent with notify become the input parameters for the template.
*
* @typedef {Parameters} TemplateParams
*/
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*
* @typedef {ReturnType} Message
*/
```
### 🙂 Expected behavior
It should emit the comment just once:
```ts
/**
* The template passed to generate messages
*/
export type Template = (...args: any[]) => any;
/**
* The arguments sent with notify become the input parameters for the template.
*/
export type TemplateParams = Parameters;
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*/
export type Message = ReturnType;
```
or even better (See #61664)
```ts
/**
* The template passed to generate messages
*
* @param Arguments to the template
* @returns The generated message
*/
export type Template = (...args: any[]) => any;
/**
* The arguments sent with notify become the input parameters for the template.
*/
export type TemplateParams = Parameters;
/**
* The return value from the template is yielded as the message generated from
* the subscription. The following types help define this relationship.
*/
export type Message = ReturnType;
```
### Additional information about the issue
_No response_
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Bericht mit TypeScript v5.9.2 unter Verwendung des bereitgestellten JavaScript/JSDoc-Snippets und verfolge anschließend den für die doppelten Kommentare verantwortlichen Pfad der Deklarationsausgabe. Füge einen Regressionstest für die ausgegebenen Deklarationen hinzu und überprüfe, dass jeder Kommentar einmal erscheint, während du das zugehörige Verhalten von #61664 überprüfst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100