MCPcopy Index your code
hub / github.com/Effect-TS/effect / whenAnd

Function whenAnd

packages/effect/src/internal/matcher.ts:310–335  ·  view source on GitHub ↗
(
  ...args: [...patterns: P, f: Fn]
)

Source from the content-addressed store, hash-verified

308
309/** @internal */
310export const whenAnd = <
311 R,
312 const P extends ReadonlyArray<
313 Types.PatternPrimitive<R> | Types.PatternBase<R>
314 >,
315 Ret,
316 Fn extends (_: Types.WhenMatch<R, Types.ArrayToIntersection<P>>) => Ret
317>(
318 ...args: [...patterns: P, f: Fn]
319) =>
320<I, F, A, Pr>(
321 self: Matcher<I, F, R, A, Pr, Ret>
322): Matcher<
323 I,
324 Types.AddWithout<F, Types.PForExclude<Types.ArrayToIntersection<P>>>,
325 Types.ApplyFilters<
326 I,
327 Types.AddWithout<F, Types.PForExclude<Types.ArrayToIntersection<P>>>
328 >,
329 A | ReturnType<Fn>,
330 Pr
331> => {
332 const onMatch = args[args.length - 1] as any
333 const patterns = args.slice(0, -1) as unknown as P
334 return (self as any).add(makeWhen(makeAndPredicate(patterns), onMatch))
335}
336
337/** @internal */
338export const discriminator = <D extends string>(field: D) =>

Callers

nothing calls this directly

Calls 3

makeWhenFunction · 0.85
makeAndPredicateFunction · 0.85
addMethod · 0.65

Tested by

no test coverage detected