Here is a simplified example to reproduce the issue, also inlined below for convenience:
// @flow
export interface Continue <a, b> {
continue(ok:a):b
}
class Chain <a, b> {
handler:Continue<a, b>
constructor(handler:Continue<a, b>) {
this.handler = handler
}
}
class Then <a, b> {
continue:(input:a) => b
toFrame():Chain<a, b> {
return new Chain(this.continue) // <- should be an error here!!
}
}
Flow does not catches an error that I have introduced when I modified an interface of Chain class from taking a function to continue to an object with method continue.
It is also worth mentioning that if I change Continue to be a type flow reports an error as expected, which I found surprising. Unfortunately I to use implements Continue<a, b> it needs to be an interface.
Simpler example:
interface T1 {
foo: string;
}
type T2 = {
foo: string;
}
var a: T1 = (() => {}: () => void); // no error
var b: T2 = (() => {}: () => void); // error
Most helpful comment
Simpler example: