microsoft / microsoft/TypeScript
Preserve the jsdoc comments for interface while compiling.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia eseguendo tsc sull'esempio test.ts fornito e confrontando il test.js generato con l'output richiesto. Definisci il comportamento della configurazione e verifica che i commenti JSDoc di interface e type vengano preservati senza modificare l'output a runtime.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100