( ...args: [...patterns: P, f: Fn] )
| 308 | |
| 309 | /** @internal */ |
| 310 | export 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 */ |
| 338 | export const discriminator = <D extends string>(field: D) => |
nothing calls this directly
no test coverage detected