Type spread over union type doesn't work
- Dominant language
- JavaScript
- Stars
- 797
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
This is a:
- [x] Bug Report
- [ ] Feature Request
- [ ] Question
- [ ] Other
Which concerns:
- [x] flow-runtime
- [x] babel-plugin-flow-runtime
- [ ] flow-runtime-validators
- [ ] flow-runtime-mobx
- [ ] flow-config-parser
- [ ] The documentation website
---
### What is the current behaviour?
A type spread over a union creates invalid code
```
type C1 = { type: "C1", test1: string };
type C2 = { type: "C2", test2: number }
type Cs = C1 | C2
type Err = { id: number, ...Cs }
console.log(Err.properties);
```
---
### What is the expected behaviour?
To be consistent with Flow's semantics
[Try Flow example](https://flow.org/try/#0C4TwDgpgBAwgjFAvFA3lUkBcUBE8cA06EAzsHNmQE4CWAdgOZQC+A3AFDsbQwBMSqdOAjY8vQsTK9sdAK4BbAEYQqLTt1gkB8KAB9YvdcKgBRKquRoaAExkLlVIgDoXMLc04BjAPZ0yUaGwzC0EbbDgAdiINUXxo0nJRAHdvKgBregYcFiA)
---
### Which package versions are you using?
Reproducible on live demo https://codemix.github.io/flow-runtime/#/try
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.