Readonly Array sorting

How do you sort using theReadonlyArray?

I use effect/Schema to decode some unknowns which contain arrays. This results in readonly myArray but I can't sort these arrays using the standard js methods. So I tried to look into how to manipulate these arrays and stumbled on the ReadonlyArray however I can only find type definitions and no examples. I have tried something like the following (which didn't work):

pipe(
  E.succeed(myParsedArr),
  RA.sort((a: Item, b: Item) => a.id - b.id)
)


Then I stumbled Across Order.Order and became even more lost haha. I'd love to learn how to use this properly since everything in Effect seemed foreign but turned out to be extremely powerful once I understood it (and when to apply it).
Either way any help would be greatly appreciated!
Was this page helpful?