facebook / facebook/flow

$Keys of a subclass errors incorrectly on superclass keys

Open
#2,497 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

[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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.