Make DOM types available without polluting the global scope with 790 global variables

Aperta
#1,734 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

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
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
tooling, web-dev

Direzione di ricerca

Non vengono indicati file, test o punti di ingresso. Inizia esaminando come questo repository genera i file della libreria DOM e come l’opzione lib: ['DOM'] espone le dichiarazioni; confronta l’output attualmente generato con il comportamento richiesto limitato ai tipi. Il lavoro è completato quando le informazioni sui tipi DOM sono disponibili senza introdurre i globals indesiderati elencati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Adding lib: ['DOM'] introduces 790 global variables. Many of these are deprecated and useless. Many of them have short names that can hide mistakes like a missing var or let. Some obvious offenders that absolutely result in regular bugs:

  • event
  • closed
  • parent
  • screen
  • status
  • toolbar
  • top
  • length
  • self
  • history
  • location
  • origin

For this reason I have so far refrained from using lib: ['DOM'] in my projects and prefer to access all globals via window.foo instead for clarity and safety.

However, this means that TS doesn't know about any of these types. Please can we make these types available so that we can at least access and use the type information without polluting the global scope with all these variables.

I'd be happy with one that just declares document and window globals, or a types-only version that leave all globals up to us, either way I don't mind, just anything that makes the types available without all these junk globals.

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/TypeScript-DOM-lib-generator

Tutte le issue di microsoft/TypeScript-DOM-lib-generator

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.