microsoft / microsoft/TypeScript
is out-of-bounds in tuple of length,but the introduction in the document can be out of bounds
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
TypeScript Version: 3.2.0
Code
This is the official demo
// Declare a tuple type
let x: [string, number];
// Actually,this code will throw error
x[3] = 'world'; // OK, 'string' can be assigned to 'string | number'
Expected behavior:
I want to know if this is a bug or this is document error
Actual behavior:
Tuple out of bounds will trow error, but document say When accessing an element outside the set of known indices, a union type is used instead

Related Issues: NO
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 damit, das Verhalten beim Zugriff auf und bei der Zuweisung zu Tupeln im verlinkten TypeScript Playground zu reproduzieren, und vergleiche es anschließend mit dem im Issue zitierten Abschnitt der offiziellen Dokumentation. Aktualisiere die Dokumentation, um den Zugriff auf Tupel außerhalb des gültigen Bereichs korrekt zu erklären, und stelle sicher, dass das Beispiel nicht länger suggeriert, dass die Zuweisung gültig ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100