microsoft / microsoft/TypeScript
Migrate `String` to `StringPrototype`, `Number` to `NumberPrototype`, etc
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Suggestion
🔍 Search Terms
string prototype object number stringprototype
✅ 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
We're always seeing people writing String, Number, Object, and so on, in places where they should be writing their primitive equivalents.
We should mark these as @deprecated so that they show up with strikethroughs in the editor, and make new global interfaces named e.g. StringPrototype so it's more clear what they're for.
/**
* @deprecated Use `string` when working with strings, or use `StringPrototype` to declare new string methods
*/
interface String {
For back compat, possibly forever, we'll need to declare these as
interface StringPrototype extends String { }
so that existing references to String["charAt"] continue to work and so that other merges continue to function.
📃 Motivating Example
💻 Use Cases
- New users coming to TS
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue nennt keine Dateien, Tests oder Einstiegspunkte. Beginne mit der Überprüfung der vorgeschlagenen globalen Schnittstellenänderungen und der verlinkten TypeScript-Designziele; abgeschlossen wäre die Aufgabe, wenn veraltete Wrapper-Schnittstellen sowie kompatible Deklarationen für StringPrototype, NumberPrototype und verwandte Typen vorhanden sind, ohne bestehende Referenzen zu beschädigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100