facebook / facebook/flow

$Keys of a subclass errors incorrectly on superclass keys

Aperta
#2,497 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

[Example](https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVBjGBDAzrsAYTAG9UwwAPALjADsBXAWwCMBTAJwG5UBfdLHgIARMG0oAXNnQAmBYiX6oYbCWBlgAvPTZJhACgCU6FWpr1m7DlvUA6SmGDAwAOThiOHOB2WqwAa1oAEgBpNgBPXAAeYQA+GwBySgTHZwBRT29UIA)

In this example, `'x'` should satisfy the type `$Keys` since `x` is a field on the superclass, but instead it throws an error.

---

``` js
/* @flow */

class C {
x: number;
}

class D extends C {}

let d = new D()

let x: number = d.x // No error
let k: $Keys = 'x' // Error
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.