Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
giacomoran opened this issue May 22, 2024 · 0 comments
Open

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

giacomoran opened this issue May 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@giacomoran
Copy link
Contributor

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 giacomoran added the bug Something isn't working label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant