effect icon indicating copy to clipboard operation
effect copied to clipboard

Type error on `Match.type` for tuple of options

Open giacomoran opened this issue 1 year ago • 0 comments

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

giacomoran avatar May 22 '24 17:05 giacomoran