Error using union types in interface
Open
question
Typing: interfaces
Typing: property variance
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Minimal reproduction:
```js
// @flow
interface Foo {
type: string | string[];
}
function bar(): Foo {
return { type: 'hello' };
}
```
Expected behavior: Flow type-checks without issue.
Actual behavior: Error
```
test.js:3
3: type: string | string[];
^^^^^^^^ array type. This type is incompatible with the expected return type of
6: return { type: 'hello' };
^^^^^^^ string
```
Flow version: 0.47.0
Contributor guide
Assessment
This issue has not been assessed yet.