microsoft / microsoft/TypeScript

Move TextEncoder out of lib.dom.d.ts.

Offen
#31,535 9 Kommentare 12 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Awaiting More Feedback Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

Search Terms

TextEncoder

Suggestion

Put (window|global).TextEncoder in a library that is automatically available to both browser and nodejs.

Use Cases

TextEncoder now exists on window in all major browsers as well as on global in NodeJS (as of NodeJS 11). At the moment, the TextEncoder definition lives in lib.dom.d.ts which means it isn't available when working on a project/library that is targeting both NodeJS and Browser.

I don't mind submitting a PR, but I don't know where the appropriate location for such a change is, and how to reconcile it properly with removal from lib.dom.d.ts. It isn't part of an annual ES specification, but it should go somewhere that is automatically included in both browser and node now that it is implemented by both. The specification for it can be found at https://encoding.spec.whatwg.org/ and I believe that is what has been implemented in NodeJS.

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Lesen von lib.dom.d.ts und vergleiche die dort für Browser und NodeJS beschriebene Verfügbarkeit von TextEncoder. Erledigt ist es, wenn die Deklaration aus lib.dom.d.ts entfernt und in eine Bibliothek verschoben wird, die für Projekte sowohl im Browser als auch in NodeJS automatisch verfügbar ist; im Issue wird keine Testdatei genannt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
node.js, typescript
Bereich
tooling
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.