Add `DOM` namespace to prevent shadowing by Node global types (e.g. `ReadableStream`)?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- tooling
Direzione di ricerca
Inizia riproducendo il comportamento di risoluzione dei tipi segnalato con lib: ["dom"] e lib: ["dom", "dom.AsyncIterable"], confrontando le dichiarazioni DOM e Node per ReadableStream. Esamina come questo repository genera i file della libreria DOM e definisci una soluzione che fornisca riferimenti ai tipi DOM stabili senza copie di dichiarazioni mantenute manualmente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I'm maintaining libs that target both browsers and Node (through different bundles, but the source code is shared).
I'm bumping into problems specifically with the type definitions of streams, e.g. ReadableStream, which are declared globally both by @types/node and the dom lib.
While I can specify access to the Node declaration via NodeJS.ReadableStream, the same is not true for the dom one, which results in non-deterministic behavior about whether ReadableStream gets resolved as dom or Node (which are not compatible). I need a way to reference a ReadableStream type that will always resolve to the DOM types, and I thought adding the option to refer to it by namespace could be a simple solution.
As an example of the issue I am experiencing: if I use lib: ["dom"] in the tsconfig, the dom declaration is picked up, but if I instead declare lib: ["dom", "dom.AsyncIterable"], then the Node types take precedence. I assume this has to do with types/dependency order resolution, but it is obviously problematic, esp. when it comes to dependents of my libs, who will also have to deal with type resolution issues based on their tsconfigs.
I'd love to see a solution around this that does not involve copying the DOM types to .d.ts files I manually maintain in the repo; I have done this in the past and it is quite disruptive, as I'd like to support several typescript versions.
- Lingua principale
- TypeScript
- Stelle
- 740
- Fork
- 474
- Merge medio
- 2g 8h
- PR unite (30g)
- 15
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Altre issue di microsoft/TypeScript-DOM-lib-generator
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
microsoft/TypeScript-DOM-lib-generator#2554 · 6 commenti ·
-
lib.d.ts bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
lib.d.ts bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
microsoft/TypeScript-DOM-lib-generator#2154 · 1 reazione ·
-
lib.d.ts bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/TypeScript-DOM-lib-generator#2107 · 5 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/TypeScript-DOM-lib-generator#1675 · 2 commenti · 1 reazione ·
Tutte le issue di microsoft/TypeScript-DOM-lib-generator
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Apertabug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
calcite-components needs triage refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Esri/calcite-design-system#15203 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
danielmiessler/LifeOS#2218 ·