Effect CommunityEC
Effect Communityβ€’3y agoβ€’
17 replies
canastro

Code compatibility issue with different versions of "@effect/data", "@effect/io", and "@effect/sc...

I have this super noob question, this piece of code:

pipe(
  ctx.selectedMembershipRole,
  O.fromNullable,
  Effect.catchTag('NoSuchElementException', () =>
    Effect.fail(new NoSelectedMembershipException({}))
  )
);


Worked with:

"@effect/data": "^0.12.10",
"@effect/io": "^0.29.2",
"@effect/schema": "^0.23.0",


but not with:

"@effect/data": "^0.15.0",
"@effect/io": "^0.32.2",
"@effect/schema": "^0.26.1",


It fails TS with:

Argument of type '<R, A>(self: Effect<R, { _tag: string; }, A>) => Effect<R, { _tag: string; } | NoSelectedMembershipException, A>' is not assignable to parameter of type '(b: Option<{ workspaceId: string & BRAND<"ID">; role: "member" | "admin" | "owner"; }>) => Effect<unknown, { _tag: string; } | NoSelectedMembershipException, unknown>'.
  Types of parameters 'self' and 'b' are incompatible.
    Type 'Option<{ workspaceId: string & BRAND<"ID">; role: "member" | "admin" | "owner"; }>' is not assignable to type 'Effect<unknown, { _tag: string; }, unknown>'.
      Type 'None<{ workspaceId: string & BRAND<"ID">; role: "member" | "admin" | "owner"; }>' is missing the following properties from type 'Effect<unknown, { _tag: string; }, unknown>': [EffectTypeId], [symbol], [symbol]


And I can't figure out why... Any clue?
Was this page helpful?