Abstract methods
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.