Add `DOM` namespace to prevent shadowing by Node global types (e.g. `ReadableStream`)?
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- tooling
Línea de trabajo
Empieza reproduciendo el comportamiento de resolución de tipos informado con lib: ["dom"] y lib: ["dom", "dom.AsyncIterable"], comparando las declaraciones de DOM y Node para ReadableStream. Revisa cómo este repositorio genera los archivos de la biblioteca DOM y define una solución que proporcione referencias de tipos DOM estables sin copias de declaraciones mantenidas manualmente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 740
- Forks
- 474
- Merge medio
- 2 d 8 h
- PR fusionados (30 d)
- 15
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/TypeScript-DOM-lib-generator
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
microsoft/TypeScript-DOM-lib-generator#2554 · 6 comentarios ·
-
lib.d.ts bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
lib.d.ts bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
microsoft/TypeScript-DOM-lib-generator#2154 · 1 reacción ·
-
lib.d.ts bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript-DOM-lib-generator#2107 · 5 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript-DOM-lib-generator#1675 · 2 comentarios · 1 reacción ·
Todos los issues de microsoft/TypeScript-DOM-lib-generator
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
copse-dev/agent-pane#2953 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Abiertobug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Client support matrix inclusion Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
calcite-components needs triage refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Esri/calcite-design-system#15203 ·