Skip to content

Array.match should return NonEmptyArray when given Array #5497

Closed

Description

@OliverJAsh

What version of Effect is running?

3.16.12

What steps can reproduce the bug?

import { Array, pipe } from 'effect';

const array: Array<number> = [1, 2, 3];

pipe(
  array,
  Array.match({
    onEmpty: () => 1,
    onNonEmpty: (xs) => {
      // ❌ `xs` has type `readonly [number, ...number[]]
      // Expected `[number, ...number[]]`
      return 1;
    },
  }),
);

What is the expected behavior?

See above.

What do you see instead?

See above.

Additional information

I tried to fix it but ran into an issue that I'm not sure how to fix: #5496

Activity

  1. added
    bug
    on Sep 12, 2025
  2. changed the title [-]`Array.match` returns `NonEmptyReadonlyArray` when given `Array`[/-] [+]`Array.match` should return `NonEmptyArray` when given `Array`[/+] on Sep 12, 2025
  3. removed
    bug
    on Sep 18, 2025
  4. added
    3.0
    on Jul 14, 2026
  5. added
    bug
    on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions