-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: add type predicate overloading of 'filter' function #11
Conversation
@@ -92,14 +92,14 @@ function uniqBy<A extends Iterable<unknown> | AsyncIterable<unknown>, B>( | |||
|
|||
if (isIterable(iterable)) { | |||
return pipe( | |||
iterable as Iterable<IterableInfer<A>>, | |||
iterable, | |||
filter((a) => pipe1(f(a), checkAndAdd)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change this line to remove type error.
It was caused by following definition.
function filter<
A extends Iterable<unknown> | AsyncIterable<unknown>,
B extends IterableInfer<A>,
>(
f: (a: IterableInfer<A>) => a is B,
): (iterable: A) => ReturnIterableIteratorType<A, B>;
I can not sure it is right definition.
bb87184
to
02cc7e0
Compare
@@ -85,7 +85,7 @@ | |||
"prettier --write", | |||
"git add" | |||
], | |||
"*.json": [ | |||
"*.(json|md)": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre commit hook did not check markdown files but CI does.
so CI failed if someone edit markdown file and did not run prettier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't think of this part Thank you for your contribution👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
To make
type predicate
work as expected in filter function.I forgot to add this one in previous PR 😄