Support overloading method signatures in object types
Open
Typing: object model
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I want to do something like this in Flow
```
type DifferentOutputs = {
doThing(name: 'number'): number;
doThing(name: 'Promise'): Promise;
}
function f(d: DifferentOutputs) {
var n: number = d.doThing('number');
}
```
This code is now rejected by Flow.
This logic is actually possible in flow - but only in the declaration files. See : https://github.com/facebook/flow/blob/master/lib/dom.js#L292-L310
I am not sure how to write this logic into my own types, and why it's possible only in external declarations.
Contributor guide
Assessment
This issue has not been assessed yet.