Can someone explain why this works:
const foo: number | null = null;
And the following does not? For me they are the same, but Flow found some error.
interface Bar {
foo: number | null;
}
const bar: Bar = {
foo: null,
}
// Error
27: foo: null,
^ Cannot assign object literal to `bar` because null [1] is incompatible with number [2] in property `foo`.
References:
27: foo: null,
^ [1]
23: foo: number | null;
^ [2]