Union to Intersection Error in Effect Pipe Usage

This feels like I"m missing something obvious but why is a union turned into an intersection here?

import * as Effect from "effect/Effect";

declare const someEffect: Effect.Effect<string> | Effect.Effect<{ val: string }>;

someEffect.pipe(Effect.map((val) => val));
/*

Argument of type '<E, R>(self: Effect<string & { val: string; }, E, R>) => Effect<string & { val: string; }, E, R>' is not assignable to parameter of type '(_: Effect<string, never, never> | Effect<{ val: string; }, never, never>) => Effect<string & { val: string; }, never, never>'.
  Types of parameters 'self' and '_' are incompatible.
    Type 'Effect<string, never, never> | Effect<{ val: string; }, never, never>' is not assignable to type 'Effect<string & { val: string; }, never, never>'.
      Type 'Effect<string, never, never>' is not assignable to type 'Effect<string & { val: string; }, never, never>'.
        Type 'string' is not assignable to type 'string & { val: string; }'.
          Type 'string' is not assignable to type '{ val: string; }'.
*/
Was this page helpful?