Abstract methods
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.