microsoft / microsoft/TypeScript
Docs: "Type assertion" vs "asserts" keyword
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Hey there!
I’m updating Programming TypeScript to include assertions in control flow analysis, and was looking for guidance about naming.
Type assertions (x as T) and assertions in control flow analysis (asserts x is T) are similarly named. What’s a good way to call these these features, in a way that doesn’t confuse people and aligns with the way the TS team is communicating it?
A couple of ideas:
- Rename
x as Tto “type coercion” or “type casting" (even though it’s not a runtime behavior), and callasserts x is Ta “type assertion” - Keep
x as Tas-is (“type assertion”), and callasserts x is Ta “user-defined type assertion”, similar to a “user-defined type guard”
Thanks!
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 esaminando la pull request collegata 32695 e la discussione dell’issue su x as T rispetto a asserts x is T. Il lavoro è completato quando si è raggiunta una convenzione di denominazione condivisa, in linea con la comunicazione di TypeScript e in grado di guidare l’aggiornamento di Programming TypeScript.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100