Abstract methods
- Ngôn ngữ chính
- Rust
- Star
- 22.3k
- Fork
- 1.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
I have the following use case for abstract methods:
```js
declare class RelayMutation {
getMutation(): T;
getVariables(): $Exact<$GraphqlVars>;
}
class MyMutation extends RelayMutation {
getMutation(): {
return Relay.QL`mutation {likeUser}`; // expects {userID: string}
}
getVariables() {
return {id: '123'}; // error: field `userID` not found
}
}
```
`$GraphqlVars` extracts variables-object from graphql-query. I want Flow to check that `getVariables()` returns object that query from `getMutation()` expects. If I define method `getVariables`, then Flow checks object shape. But if `MyMutation#getVariables` is not defined, Flow will not complain.
Are there any plans for abstract methods in declarations? I might try to help to implement that.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.