microsoft / microsoft/TypeScript
typedef imports should use default exports
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Search Terms
checkJs typedef import
Suggestion
When the module ./core.controller has a default export defined, I would like to be able to do:
/**
* @typedef { import("./core.controller") } Chart
*/
Instead of:
/**
* @typedef { import("./core.controller").Chart } Chart
*/
Use Cases
My file had defined export default Chart;.
TypeScript made me add a duplicate export, which I don't want to have to add
export {
Chart
};
This resulted in lots of extra code
It also took me an extremely long amount of time to figure out I needed to do this because the documentation did not mention this as a limitation.
Examples
Already shared in the above sections.
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, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
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 dalla sezione sui tipi di importazione del manuale di TypeScript e dalle forme esistenti di importazione di typedef JSDoc mostrate nell’issue. Segui come viene rappresentato e testato un modulo esportato di default, quindi verifica che la forma di importazione più breve sia accettata senza richiedere un export denominato duplicato e che la documentazione descriva questo comportamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100