Resolving Type Mismatch Between Readonly and Non-Readonly Arrays in TypeScript Effect Code

I'm using the following Effect code to add a default empty array value for my data:

export const getFetchedDays = () => {
  return Effect.tryPromise(() =>
    fs.readFile("./data/fetchedDays.json", "utf-8")
  ).pipe(
    Effect.flatMap(S.decode(S.parseJson(S.Array(S.String)))),
    Effect.orElseSucceed<string[]>(() => [])
  );
};


However, I'm facing a type mismatch between readonly and non-readonly arrays. The inferred type is:

const getFetchedDays: () => Effect.Effect<string[] | readonly string[], never, never>


How can I fix this issue? Is there a way to convert S.Array to a non-readonly array?
Was this page helpful?