microsoft / microsoft/TypeScript
Declaration merging in plain JS with JSDoc
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔍 Search Terms
jsdoc declaration merging
✅ Viability Checklist
- 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 isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Ability to merge declarations.
📃 Motivating Example
For example, this is a declaration merge in TS:
export const Foo = makeFooClass()
export type Foo = InstanceType<typeof Foo>
In JS we can't do this. I was hoping for something similar to this to achieve the same:
export const Foo = makeFooClass() // returns a class
/** @export {InstanceType<typeof Foo>} Foo */
💻 Use Cases
- What do you want to use this for? To merge declarations in certain cases.
- What shortcomings exist with current approaches? There's no way to do it AFAICT
- What workarounds are you using in the meantime? None
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 con gli esempi motivanti in TypeScript e plain JavaScript nell’issue, poi leggi la discussione per comprendere il comportamento proposto di declaration merging e le limitazioni esistenti. Il lavoro è completo quando è stato concordato un design JSDoc praticabile e declaration merging è stato implementato senza modificare il JavaScript emesso né il comportamento esistente 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