Skip to content

Conversation

dominictobias
Copy link

@dominictobias dominictobias commented Oct 4, 2023

Most of the utils which were not converted from TS are now natively supported in Flow.

I had to update the spread test as you can see, using spread for inexact object types now fails: Flow Playground

new:

Pick: https://flow.org/en/docs/types/utilities/#toc-pick
Exclude: https://flow.org/en/docs/types/utilities/#toc-exclude
Extract: https://flow.org/en/docs/types/utilities/#toc-extract

now natively supported:

Omit: https://flow.org/en/docs/types/utilities/#toc-omit
Partial: https://flow.org/en/docs/types/utilities/#toc-partial
Required: https://flow.org/en/docs/types/utilities/#toc-required

this + default generic arguments are supported so don't need to be removed

replace deprecated $ElementType and $PropertyType with indexed access types T[K]

https://flow.org/en/docs/types/utilities/#toc-propertytype
https://flow.org/en/docs/types/utilities/#toc-elementtype

typeof AuthMechanism,
$Keys<typeof AuthMechanism>
>;
export type AuthMechanismType1 = (typeof AuthMechanism)[$Keys<
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know what is adding parenthesis around (typeof AuthMechanism) but it's not breaking types 🤷‍♂️

@dominictobias
Copy link
Author

P.S. Guards are also supported - https://flow.org/en/docs/types/type-guards/
though not sure how to do this one, I don't know where the code is that's removing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant