Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add option to use Merge from type-fest to better conversion of object type spreads #235

Open
kevinbarabash opened this issue Mar 3, 2021 · 0 comments
Labels
conversion enhancement New feature or request

Comments

@kevinbarabash
Copy link
Contributor

kevinbarabash commented Mar 3, 2021

Object type spreads in flow result in properties that come later overriding those that come sooner, e.g.

type A = {foo: string};
type B = {foo: number};
type C = {...A, ...B} // same as {foo: number}

In TypeScript if we do type C = A & B we end up with {foo: never} because the intersection between string and number is empty.

type-fest has a bunch of utility types including Merge which provides the same functionality as Flow's type spreads.

Does anyone has code the relies on Flow's object type spread functionality?

@kevinbarabash kevinbarabash added enhancement New feature or request conversion labels Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
conversion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant