facebook / facebook/flow

Function from class to class

Offen
#3,915 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
22.3k
Forks
1.9k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.