-
-
Notifications
You must be signed in to change notification settings - Fork 509
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Effect is running?
3.19.15
What steps can reproduce the bug?
When using Match.tag on union type that includes undefined/null, it will produce runtime error when the Match.tag is before Match.when(undefined, ...). The code type checks correctly.
Reproduciton steps
import { Match } from "effect"
const value = undefined as ({_tag: "A"} | undefined)
const res = Match.value(value).pipe(
Match.tag('A', () => 'mached A'), // <- crashes with `Cannot read properties of undefined (reading '_tag')`
Match.when(undefined, () => 'matched undefined'),
Match.exhaustive
);
console.log(res);Or in playground: https://effect.website/play/#b2df3d05e29a
What is the expected behavior?
The code does not crash
What do you see instead?
No response
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working