microsoft / microsoft/TypeScript
Infinities as number literal types
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔎 Search Terms
infinity number literal
🕗 Version & Regression Information
- This changed in PR https://github.com/microsoft/TypeScript/pull/55268
⏯ Playground Link
💻 Code
type PositiveInfinity = 1e999;
// ^?
type NegativeInfinity = -1e999;
// ^?
🙁 Actual behavior
In TS 5.2 we get NumberLiteralTypes with Infinity and -Infinity values.
In the upcoming TS 5.3 we get a number type in the of the PositiveInfinity
🙂 Expected behavior
I don't know. I created this issue to discuss exactly that.
Should this part of the change be reverted and should Infinity be allowed as a literal number value? Or should -Infinity be aligned with Infinity and should it be converted~ to a number type as well?
Additional information about the issue
I didn't see an Infinity as a literal type so I made this change while working in this area. @rbuckton commented here:
I really hope no one is relying on this.
but it turns out that some try to rely on this. We can see it in this issue, cc @Max10240
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 dem verlinkten Playground-Beispiel und vergleiche das Verhalten von TypeScript 5.2 mit dem anstehenden, durch PR 55268 eingeführten Verhalten von 5.3. Lies die Diskussion in diesem Pull Request und in Issue 56270 und lege anschließend fest, wie positive und negative Unendlichkeit behandelt werden sollen, bevor du das Compilerverhalten und die zugehörige Regressionstestabdeckung änderst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100