We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.1.4
given this initial code:
import { Effect } from "effect"; class LoaderArgs extends Effect.Tag("@services/LoaderContext")< LoaderArgs, { context: number } >() {}
the LoaderArgs.context is correctly typed as an effect in typescript, and in runtime is present (a function is shown)
LoaderArgs.context
however, I cannot do LoaderArgs.context.pipe(... as it throws a runtime exception ("cannot find 'pipe' in undefined")
LoaderArgs.context.pipe(...
also this code fails:
Effect.runSync( Effect.map(LoaderArgs.context, (ctx) => console.log({ ctx })).pipe( Effect.provideService(LoaderArgs, { context: 5 }), ), );
Effect.runSync( Effect.flatMap(LoaderArgs.context, (ctx) => { console.log({ ctx }); return Effect.void; }).pipe(Effect.provideService(LoaderArgs, { context: 5 })), );
with this error:
my small repro is in bun, but I first encountered it with node
also, the following ways of expressing the same code work:
Effect.runSync( Effect.map(LoaderArgs, ({context: ctx}) => console.log({ ctx })).pipe( Effect.provideService(LoaderArgs, { context: 5 }), ), );
and
Effect.runSync( LoaderArgs.pipe( Effect.map(({ context: ctx }) => console.log({ ctx })), Effect.provideService(LoaderArgs, { context: 5 }), ), );
the code should work (not throw) as with Effect.Tag member services should just be plain effects which work with every mode of map, flatMap etc...
No response
The text was updated successfully, but these errors were encountered:
It would appear that property names that clash with the tag class (so context, of, etc.) are prohibted here.
context
of
Merely changing the name from context to something else should work.
./cc @mikearnaldi
Sorry, something went wrong.
Yeah it is a name clash, unfortunately Tag already have some members, wondering if we can issue a type error in such cases
Successfully merging a pull request may close this issue.
What version of Effect is running?
3.1.4
What steps can reproduce the bug?
given this initial code:
the
LoaderArgs.context
is correctly typed as an effect in typescript, and in runtime is present (a function is shown)however, I cannot do
LoaderArgs.context.pipe(...
as it throws a runtime exception ("cannot find 'pipe' in undefined")also this code fails:
also this code fails:
with this error:
my small repro is in bun, but I first encountered it with node
also, the following ways of expressing the same code work:
and
What is the expected behavior?
the code should work (not throw) as with Effect.Tag member services should just be plain effects which work with every mode of map, flatMap etc...
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: