microsoft / microsoft/TypeScript
Infinities as number literal types
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’esempio Playground collegato e confronta il comportamento di TypeScript 5.2 con il comportamento imminente di 5.3 introdotto da PR 55268. Esamina la discussione in quella pull request e nell’issue 56270, quindi stabilisci il trattamento previsto dell’infinito positivo e negativo prima di modificare il comportamento del compilatore e la relativa copertura delle regressioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100