escalier-lang / escalier-next

Improved type safety with tight TypeScript interop
https://escalier-lang.github.io/escalier-next/
MIT License
14 stars 0 forks source link

Add support for `as <ident>` to pattern matching #363

Open kevinbarabash opened 2 months ago

kevinbarabash commented 2 months ago

This is so that we can mutate discriminated unions, e.g.

        declare let mut foo: { type: "a", v: number } | {type: "b", v: string };
        match foo {
          {type: "a"} as foo => foo.v = 5,
          {type: "b"} as foo => foo.v = "hello",
        };