microsoft / microsoft/TypeScript
Preserve the jsdoc comments for interface while compiling.
Offen
Dieses Issue hat noch niemand übernommen.
Awaiting More Feedback
Suggestion
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
Suggestion
🔍 Search Terms
tsc jsdoc
✅ Viability Checklist
My suggestion meets these guidelines:
- ✅ This wouldn't be a breaking change in existing TypeScript/JavaScript code
- ✅ This wouldn't change the runtime behavior of existing JavaScript code
- ✅ This could be implemented without emitting different JS based on the types of the expressions
- ✅ This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- ✅ This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
Add a configuraion for preserving the jsdoc comments for interface while compiling.
📃 Motivating Example
Example
My .ts file like this:
// test.ts
/**
* @typedef {Object} ITest - For test
* @property {string} a
*/
export interface ITest {
a: string
}
/**
* @function print - print ITest
* @params {ITest} d
*/
export function print (d: ITest): void {
console.log(d.a)
}
while tsc compiling, the .js like this:
// test.js
/**
* @typedef {Object} ITest - For test
* @property {string} a
*/
/**
* @function print - print ITest
* @params {ITest} d
*/
export function print(d) {
console.log(d.a);
}
💻 Use Cases
There are two case as I can see.
- Preverse comments for files.
- Use jsdoc comments to mark interfaces or types on .ts and generate doc through jsdoc comments on .js
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
Beginne damit, tsc für das bereitgestellte test.ts-Beispiel auszuführen und die erzeugte test.js mit der angeforderten Ausgabe zu vergleichen. Definiere das Konfigurationsverhalten und überprüfe, dass JSDoc-Kommentare für interface und type erhalten bleiben, ohne die Laufzeitausgabe zu verändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100