flow-runtime icon indicating copy to clipboard operation
flow-runtime copied to clipboard

Type spread over union type doesn't work

Open EXio4 opened this issue 7 years ago • 0 comments

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


Which package versions are you using?

Reproducible on live demo https://codemix.github.io/flow-runtime/#/try

EXio4 avatar Apr 14 '18 17:04 EXio4