Effect CommunityEC
Effect Community3y ago
84 replies
mildfuzz

NextApiService Interface and Tag Definition

I have the following service definition:
export interface NextApiService {
  readonly next: Effect.Effect<
    never,
    never,
    {req: NextApiRequest; res: NextApiResponse}
  >
}

export const NextApiService = Context.Tag<NextApiService>(
  '@home/NextApiService',
)


which I am trying to consumer in the following pipe:

const program = (generalEnquiryDate: string) =>
  NextApiService.pipe(
    withParentAccountRefs,
    redemptionsApiEffect(generalEnquiryDate),
  )

But I am seeing the following TS compilation error and I am not sure what I am doing wrong:

The 'this' context of type 'Tag<NextApiService, NextApiService>' is not assignable to method's 'this' of type '{ req: NextApiRequest; res: NextApiResponse<any>; }'.

Type 'Tag<NextApiService, NextApiService>' is missing the following properties from type '{ req: NextApiRequest; res: NextApiResponse<any>; }': req, res
Was this page helpful?