niieani / typescript-vs-flowtype

Differences between Flowtype and TypeScript -- syntax and usability
MIT License
1.74k stars 78 forks source link

type spread operator #2

Closed vkurchatkin closed 7 years ago

vkurchatkin commented 7 years ago

Could you clarify, what you mean by type spread operator?

niieani commented 7 years ago

The spread type { ...A, ...B } combines the properties, but not the call or construct signatures, of entities A and B.

Source: https://github.com/Microsoft/TypeScript/pull/11150

Note that this is spread for types, not for actual objects (which is also supported and uses the underlying spread types).

vkurchatkin commented 7 years ago

Doesn't seem to work in repl: https://www.typescriptlang.org/play/index.html#src=interface%20Congealed%3CT%2C%20U%3E%20%7B%0D%0A%20%20%20%20...T%0D%0A%20%20%20%20...U%0D%0A%7D

niieani commented 7 years ago

Ah, I think this still hasn't been released and is slated for TS 2.2. I'll add a note. Thanks for spotting.