microsoft / microsoft/TypeScript
String case change methods should return intrinsic string manipulation types
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
lib Update Request
Configuration Check
My compilation target is ES2018 and my lib is ["ES2016", "dom"].
Missing / Incorrect Imprecise Definitions
At least toUpperCase and toLowerCase methods on String, maybe/probably also the Locale versions?
Sample Code
type LittleT = "t" | "tt";
type BigT = Uppercase<LittleT>;
declare const smol: LittleT;
const big: BigT = smol.toUpperCase(); // err, string is not assignable to "T" | "TT
Documentation Link
https://tc39.es/ecma262/#sec-string.prototype.tolowercase
Note
I'm not sure about the Locale versions of these methods because I don't know what algorithm the "intrinsic" Uppercase<T> / Lowercase<T> helper types are required to follow. (Do we need separate LocaleUppercase / LocaleLowercase helpers?)
Also worth mentioning: I think what I'm looking for is a return type of e.g. Uppercase<this>, which shouldn't have an impact on non-literal string types because Uppercase<string> is just string.
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
Beginne mit den ES2016-Bibliotheksdeklarationen für String und den vorhandenen intrinsischen Typen Uppercase und Lowercase. Prüfe das Beispiel anhand der angeforderten Rückgabetypen und untersuche anschließend, ob die Locale-Varianten eine separate Behandlung erfordern; als erledigt gilt die Aufgabe, wenn der Fall eines Literal-Strings dargestellt wird, ohne das Verhalten von string zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100