const program = Effect.forEach(
messages.results,
(res) => {
return Effect.gen(function* () {
......
// when I remove yield the type errors disappear
const messageId = yield* Match.value(res).pipe(
Match.when({ message: { type: "TEXT" } }, (message) =>
Effect.promise(() =>
ctx.runMutation(internal.messages.insertMessage, {
...some mutation args
},
}),
),
),
....// other match.when statements very similar to the above
Match.orElse((message) =>
Effect.promise(() =>
ctx.runMutation(internal.messages.insertMessage, {
// ... some mutation args
}),
),
),
......// some other code
return yield* Effect.succeed({
destinationId,
messageId,
channel,
});
});
},
{
concurrency: "unbounded",
},
);
const program = Effect.forEach(
messages.results,
(res) => {
return Effect.gen(function* () {
......
// when I remove yield the type errors disappear
const messageId = yield* Match.value(res).pipe(
Match.when({ message: { type: "TEXT" } }, (message) =>
Effect.promise(() =>
ctx.runMutation(internal.messages.insertMessage, {
...some mutation args
},
}),
),
),
....// other match.when statements very similar to the above
Match.orElse((message) =>
Effect.promise(() =>
ctx.runMutation(internal.messages.insertMessage, {
// ... some mutation args
}),
),
),
......// some other code
return yield* Effect.succeed({
destinationId,
messageId,
channel,
});
});
},
{
concurrency: "unbounded",
},
);