niieani / typescript-vs-flowtype

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

docs(README.md): update info about type spread operator in TS #69

Closed jnv closed 4 years ago

jnv commented 4 years ago

Refs: #2, #46

If you look at the example mentioned in #2, you will see it still raises an error with TS v3.8.2: 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

That's because the original PR dropped the support for type spread and kept only the object spread. Also to my understanding, the PR currently mentioned under the "shipped" link for TypeScript (https://github.com/Microsoft/TypeScript/pull/28234) is concerned only about spread in object literals, not types.

More examples: TypeScript vs. Flow (the Flow version uses exact types, which is usually a prerequisite for using object spread).

I have changed the relevant row for object type spread and added a new section section under "Flow-only concepts".

niieani commented 4 years ago

Awesome!

Díky moc @jnv! 🙇