microsoft / microsoft/TypeScript
Object.getPrototypeOf returns `any` instead of `object | null`
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: 2.7.2
Search Terms: Object.getPrototypeOf, ObjectConstructor.getPrototypeOf, wrong return type
Code
let prototype = Object.getPrototypeOf(foo);
Expected behavior:
The type of prototype should be object | null. According to the spec, getPrototypeOf returns the value of the internal property [[Prototype]] [1] whose values can only be of type object or null [2].
Actual behavior:
prototype has type any
Playground Link: here
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 dal punto di ingresso ObjectConstructor.getPrototypeOf e riproduci l'esempio nel TypeScript playground. Verifica il tipo restituito dichiarato rispetto al comportamento ECMAScript descritto nell'issue; il lavoro è completato quando il tipo inferito è object | null anziché any.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100