facebook / facebook/flow

Function from class to class

Open
#3,915 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

How do I properly annotate the following code?

```js
const AMixin = superclass => class extends superclass {
aMixedMethod() {}
}

const ABMixin = superclass => class extends AMixin(superclass) {
bMixedMethod() {}
}

export {
AMixin,
ABMixin,
};
```

This example on [flow.org/try](https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBjOA7AzgFzAEEBZASwA8zswBeMXAVwAcBTAJwxgENdc6AfGC69+rCvlbYAJvyZtOPPmADeqMGG7kKraSVb4AFnGkAKAJSqAvqhuYcBYgCFt1OgxYcRy2kO9iJKVliV2xTeS8lXEs1DQAjbV19IxMLa1t0cWY4dkJYkMpqABp1Z1CSqwBuIA).

Analogous code without `exports` works fine with inferred types ([example](https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBjOA7AzgFzAEEBZASwA8zswBeMXAVwAcBTAJwxgENdc6AfGC69+rCvlbYAJvyZtOPPmADeqMGG7kKraSVb4AFnGkAKAJSqAvqhuYcBYgCFt1OgxYcRy2kO9iJKVliV2xTeS8lXEs1DQAjbV19IxMLa1t0f2JVdU1k4zMYmxsspzBxSRl+IhdKalMiGNyEgwK0lWLMh0I492xWJCcLAG50OIA6LUok1tTzUYmE6b1ZwoXJ-Ln1lpS11AmMTbWgA)), but I am not sure what the inferred signature is or how to get it or whether it is possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.