const matcher = Match.type<{ start: AB | null; end: AB | null }>().pipe(
Match.when({ start: null, end: null }, () => Effect.fail("")),
Match.when(
{ start: Match.instanceOf(A), end: Match.instanceOf(A) }, // error here
({ start, end }) => Effect.succeed(['as',start, end] as const)
),
Match.when(
{ start: Match.instanceOf(B), end: Match.instanceOf(B) }, // error here
({ start, end }) => Effect.succeed(['bs', start, end] as const)
),
Match.orElse(() => Effect.fail("Unsupported case"))
)
const matcher = Match.type<{ start: AB | null; end: AB | null }>().pipe(
Match.when({ start: null, end: null }, () => Effect.fail("")),
Match.when(
{ start: Match.instanceOf(A), end: Match.instanceOf(A) }, // error here
({ start, end }) => Effect.succeed(['as',start, end] as const)
),
Match.when(
{ start: Match.instanceOf(B), end: Match.instanceOf(B) }, // error here
({ start, end }) => Effect.succeed(['bs', start, end] as const)
),
Match.orElse(() => Effect.fail("Unsupported case"))
)