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

IfType type guards #788

Open
ZachHaber opened this issue Jan 2, 2024 · 2 comments · May be fixed by #961
Open

IfType type guards #788

ZachHaber opened this issue Jan 2, 2024 · 2 comments · May be fixed by #961
Labels
good first issue Good for newcomers help wanted Extra attention is needed type addition

Comments

@ZachHaber
Copy link

ZachHaber commented Jan 2, 2024

The readme mentions that there should be a corresponding IfType guard for every IsType check.

For every IsT type (e.g. IsAny), there is an associated IfT type that can help simplify conditional types.

I'm only seeing a few IfType guards in the package (IfNever, IfAny, and IfUnknown).

Potential fixes (that I can think of at the moment):

  1. Add the missing IfType guards
  2. Update the readme to specifically call out those three guards

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@sindresorhus
Copy link
Owner

PR welcome for types starting with Is that are missing an If type.

@sindresorhus sindresorhus added help wanted Extra attention is needed good first issue Good for newcomers type addition labels Jan 2, 2024
harsh-srivastava44 pushed a commit to harsh-srivastava44/type-fest that referenced this issue Jan 7, 2024
harsh-srivastava44 pushed a commit to harsh-srivastava44/type-fest that referenced this issue Jan 7, 2024
@sindresorhus sindresorhus pinned this issue Mar 8, 2024
@ikelax ikelax linked a pull request Sep 29, 2024 that will close this issue
@sindresorhus
Copy link
Owner

I'm starting to question whether it was the correct choice to add If equivalents. It seemed nice at first, but there is now so many extra types and all of them require extra docs and maintenance. Maybe we should instead have supported the extra parameters on Is* or just referred people to a If type. Thoughts?

// @ikelax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed type addition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants