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

make exists a type predicate #1952

Open
codingedgar opened this issue Aug 27, 2024 · 0 comments
Open

make exists a type predicate #1952

codingedgar opened this issue Aug 27, 2024 · 0 comments

Comments

@codingedgar
Copy link

🚀 Feature request

Current Behavior

export declare const exists: <A>(predicate: Predicate<A>) => (ma: Option<A>) => boolean

Desired Behavior

export declare const exists: <A>(predicate: Predicate<A>) => (ma: Option<A>) => ma is Some<A>

Who does this impact? Who is this for?

exists does not provide enough information to typescript, which prevents narrowing when used with libraries like ts-pattern or in plain code.

Describe alternatives you've considered

I'm not sure if this is enough or if another function might be better, because if exists returns false it doesn't mean ma is not Some<A>, but if it return true, it must be, right?

Your environment

Software Version(s)
fp-ts 2.16.2
TypeScript 5.6.0-beta
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

No branches or pull requests

1 participant