Skip to content

Type error on Match.type for tuple of options #2817

Open
@giacomoran

Description

@giacomoran

What version of Effect is running?

3.2.3

What steps can reproduce the bug?

import type { Option } from "effect";
import { Match } from "effect";

Match.type<[Option.Option<string>, Option.Option<string>]>().pipe(
  Match.when(
    [{ _tag: "Some" }, { _tag: "Some" }],
    ([a, b]) => void console.log(`a ${a.value}, b ${b.value}`),
  ),
  Match.when(
    [{ _tag: "None" }, { _tag: "Some" }],
    ([_, b]) => void console.log(`b ${b.value}`),
  ),
  Match.when(
    [{ _tag: "Some" }, { _tag: "None" }],
    ([a, _]) => void console.log(`a ${a.value}`),
  ),
  Match.when(
    [{ _tag: "None" }, { _tag: "None" }], 
    () => void console.log("none")
  ),
  // Type Error: Type `[Option<string>, Option<string>]` is not assignable to type `never`
  Match.exhaustive,
);

TS Playground

What is the expected behavior?

The exhaustive check should pass at the type level.

What do you see instead?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions