Troubleshooting Parameter Issues in Effect Program for ViewRepository

I'm trying to run the effect program with some parameters but I'm failing and I can't find a solution in the documentation. Is there any solution? Thanks
import { Context, Effect } from "effect";
import { View } from "../01-entities/views";

export class ViewRepository extends Context.Tag("ViewRepository")<
  ViewRepository,
  {
    readonly getViewDetail: (params: {
      entityName: string;
      viewName: string;
    }) => Effect.Effect<View>;
  }
>() {}

export const getViewDetail = Effect.gen(function* (
  entityName: string,
  viewName: string,
) {
  const views = yield* ViewRepository;
  return yield* views.getViewDetail({ entityName, viewName });
});

const getViewDetailUc = Effect.provideService(getViewDetail, ViewRepository, {
  getViewDetail: ({ entityName, viewName }) =>
    Effect.sync(() => ({
      entityName,
      viewName,
    })),
});

const result = Effect.runSync(
  getViewDetailUc({ entityName: "entity", viewName: "view" }),
);
console.log(result);
image.png
Was this page helpful?