Helper for Deduplicating Array Values When Encoding in Effect Typescript

Is there any helper to dedupe array values when encoding? Or has anyone written their own helpers to handle this kind of thing?

I started trying to write one...but ran into type issues and am thinking I'm probably barking up the wrong tree:

const DedupedArray = <A, I, R>(schema: S.Schema<A, I, R>) =>
  S.transform(S.Array(schema), S.Array(schema), {
    strict: true,
    encode: v => Array.dedupe(v),
    decode: identity
  });
Was this page helpful?