collectype / types/utility / Wherable
Wherable<
T,C> =object
Defined in: types/utility.ts:102
Context type for a collection or chainable API with a where method.
// Simple usage with default context (returns any)
const ctx: Wherable<{ x: number }> = {
where: (predicate) => [1, 2, 3].filter(item => predicate({ x: item }))
};
// Usage with explicit context for chaining
class MyChain implements Wherable<{ x: number }, MyChain> {
where(predicate: (item: { x: number }) => boolean): MyChain {
// ...
return this;
}
}
T
The item type in the collection.
C = any
The context type returned by where (usually the same as the containing class, for chaining).
The where method takes a predicate and returns the context C, enabling fluent chaining of filters.
where: (
predicate) =>C
Defined in: types/utility.ts:103
(item) => boolean
C