Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing flow utils #201

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add missing flow utils #201

wants to merge 6 commits into from

Conversation

sekoyo
Copy link

@sekoyo sekoyo 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 🤷‍♂️

@sekoyo
Copy link
Author

sekoyo commented Oct 5, 2023

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.

None yet

1 participant