microsoft / microsoft/TypeScript
Generating declaration file (.d.ts) for a single module
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
So many I can't list them all here, everything related to declaration files, .d.ts generation, .d.ts rollup, import ellision, etc.
✅ 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 an option to generate a .d.ts file for a single module.
📃 Motivating Example
I currently have a repository which exposes a set of types I need to use in another repo (and for legacy reasons a monorepo isn't possible). The thing is, generating a declaration file for the project will generate declaration for all modules inside this project.
What I want is only the declaration of a specific module in that project.
Let's say for instance the project contains index.ts, router.ts and schema.ts. Generating a declaration file will emit declarations for everything exported by these three files. But what I want is only what is exported by schema.ts, as it will be used for validation in another repository, whereas the other two files contain business logic that have nothing to do elsewhere, and also depend on packages that won't be available in the other repo.
💻 Use Cases
- Exporting specific types to another repository
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 dal comportamento di generazione delle dichiarazioni per i moduli indicati index.ts, router.ts e schema.ts, confrontando l’output dell’intero progetto con il caso richiesto di un singolo modulo. L’issue non indica file del compilatore né test, quindi sarebbe necessario individuarli prima. Il lavoro è completo quando un’opzione può emettere dichiarazioni solo per schema.ts senza richiedere dichiarazioni per gli altri moduli.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100