### Understanding Pattern Matching in TypeScript with Effect Schema

Hey,
I don't understand why pattern matching works like that:

import { Schema as S } from "@effect/schema"
import { Match, pipe } from "effect"

class Input extends S.Class<Input>("Input")({
  word1: S.optional(S.String),
  word2: S.optional(S.String)
}) {}

const print = (
  input: typeof Input.Type
) =>
  pipe(
    Match.value(input),
    Match.whenAnd({ word1: Match.undefined } , { word2: Match.undefined }, () =>
      console.log("first case")
    ),
    Match.orElse(() => 
      console.log("ANYWAY")
    )
  )

print({ })


result
alkondaurov@C16820 sheldon % bun run m.ts
ANYWAY


why patter matching doesn't hit first case?
Was this page helpful?