facebook / facebook/flow

Premature incompatibily errors in generic classes definitions

Aperta
#3,711 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Here is simplified example:

```js
class Task {
static spawn: (task:Task) => Task
spawn ():Task {
return Task.spawn(this)
}
}
```

Here flow reports following error:

```
6: return Task.spawn(this)
^^^^^^^^^^^^^^^^ call of method `spawn`
3: class Task {
^ x. This type is incompatible with
4: static spawn: (task:Task) => Task
^^^^^ empty
```

What I actually expect is for flow to report type error when `task.spawn()` is called on tasks that can fail (`Task`) and report no errors when called on tasks that can not fail (`Task`).

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.