import { type Brand, Context, Effect, Layer } from "effect";
type MyBrand<T> = T & Brand.Brand<"MyBrand">;
type MyContract = {
foo: () => Effect.Effect<MyBrand<string>, never>;
};
class MyService extends Effect.Service<MyContract>()("Service", {
succeed: {
foo: () => Effect.succeed("hello"), // no type error
},
}) {}
const myService = MyService.Default;
class MyContext extends Context.Tag("MyContext")<MyContext, MyContract>() {}
const myLayer = Layer.succeed(MyContext, {
foo: () => Effect.succeed("hello"), // type error
});
import { type Brand, Context, Effect, Layer } from "effect";
type MyBrand<T> = T & Brand.Brand<"MyBrand">;
type MyContract = {
foo: () => Effect.Effect<MyBrand<string>, never>;
};
class MyService extends Effect.Service<MyContract>()("Service", {
succeed: {
foo: () => Effect.succeed("hello"), // no type error
},
}) {}
const myService = MyService.Default;
class MyContext extends Context.Tag("MyContext")<MyContext, MyContract>() {}
const myLayer = Layer.succeed(MyContext, {
foo: () => Effect.succeed("hello"), // type error
});