microsoft / microsoft/TypeScript
An alternative @overload syntax for JSDoc
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
Suggestion
🔍 Search Terms
jsdoc
function
overload
✅ 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
Here's an alternative thought on the syntax that could satisfy PR #52474 without causing parser issues mentioned in PR #52577. What if overload simply allowed you to declare a method signature? For instance:
/**
* @overload { (inst, klass, members) => object }
* @overload { (inst, members) => undefined }
* @param {object} inst
* @param {function} klass
* @param {object} members
* @returns {object|undefined}
*/
function share(inst, klass, members) {}
This should be both easy to parse, and satisfy the user's needs while allowing for minimally redundant documentation, all in a single comment.
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 esaminando gli esempi JSDoc proposti e le PR referenziate #52474 e #52577, soprattutto le problematiche relative al parser. Il lavoro è considerato completato quando esiste un percorso di implementazione concordato per la sintassi @overload alternativa che affronta tali problematiche senza modificare il comportamento 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
- Specificata chiaramente
- Idoneità per principianti
- 35/100