facebook / facebook/flow

$Keys of a subclass errors incorrectly on superclass keys

未關閉
#2,497 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Rust
星號
22.3k
分支
1.9k
PR 合併指標
30 天內沒有已合併 PR

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。