Skip to content

Commit

Permalink
FindCursor: use the right type parameter for filter (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmatteini committed Nov 12, 2024
1 parent 362be60 commit 74e18f7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/effect-mongodb/src/FindCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ export class FindCursor<A, I = A, R = never> extends Data.TaggedClass("FindCurso
}

export const filter: {
// TODO: T should be I type parameter
<T extends Document = Document>(
filter: Filter<T>
): <A, I, R>(cursor: FindCursor<A, I, R>) => FindCursor<A, I, R>
<A, I, R, T extends Document = Document>(
<I extends Document>(
filter: Filter<I>
): <A, R>(cursor: FindCursor<A, I, R>) => FindCursor<A, I, R>
<A, I extends Document, R>(
cursor: FindCursor<A, I, R>,
filter: Filter<T>
filter: Filter<I>
): FindCursor<A, I, R>
} = F.dual(
(args) => isFindCursor(args[0]),
<A, I, R, T extends Document = Document>(
<A, I extends Document, R>(
cursor: FindCursor<A, I, R>,
filter: Filter<T>
filter: Filter<I>
): FindCursor<A, I, R> => new FindCursor({ cursor: cursor.cursor.filter(filter), schema: cursor.schema })
)

Expand Down

0 comments on commit 74e18f7

Please sign in to comment.