TypeScript Error When Using `Array.max` with Non-Empty Arrays in Effect-TS

I am trying to find max value in a give array. I am using https://effect-ts.github.io/effect/effect/Array.ts.html#max to achieve that.

Below is the code I have written

pipe(
    arrayOfObjects,
    Array.map(o => o.value),
    Array.max(Order.number)
  )


I am getting below typescript error
  Type 'number[]' is not assignable to type 'readonly [number, ...number[]]'.
    Source provides no match for required element at position 0 in target. [2345]


Not sure how to elegantly solve this problem.

I have asked this question in stackoverflow as well(Small effort to make make Effect more SEO friendly) - https://stackoverflow.com/questions/79596213/how-to-deal-with-nonemptyreadonlyarray-type-in-effect-ts
Was this page helpful?