Skip to content

Array.match should return NonEmptyArray when given Array #5497

@OliverJAsh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions