Error using union types in interface
Aperta
question
Typing: interfaces
Typing: property variance
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.