microsoft / microsoft/TypeScript
Cannot use Array.prototype.push.apply with NodeList, even though it works properly in all browsers.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
TypeScript Version: 3.9.x-dev.20200627
Search Terms:
strictBindCallApply NodeList
Code
const bodyChildren = document.body.childNodes;
const arr: Node[] = [];
arr.push.apply(arr, bodyChildren);
Expected behavior:
Doesn't throw errors.
Actual behavior:
Throws errors on line 3: Argument of type 'NodeListOf' is not assignable to parameter of type 'Node[]'.
Type 'NodeListOf' is missing the following properties from type 'Node[]': pop, push, concat, join, and 19 more.
Playground Link:
Playground Link
Related Issues:
Couldn't find any.
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 il Playground collegato e riproduci l'errore nello snippet TypeScript fornito. Traccia la gestione di strictBindCallApply indicata nei termini di ricerca, quindi verifica che Array.prototype.push.apply accetti l'esempio NodeList senza l'errore di tipo segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 42/100