Seeking Function to Replace Elements in Non-Empty Arrays Without Changing Type

Hi there! Is there a function that does the same thing as Array.replaceOption but keeps the "non empty type" of an array?
declare const nonEmpty: Array.NonEmptyReadonlyArray<number>;

pipe(
  nonEmpty,
  Array.replaceOption(0, 1),
  Option.map(potentiallyEmpty => potentiallyEmpty), // => potentiallyEmpty is now Array<number>
);
Was this page helpful?