Resolving TypeScript Type Error in Effect-Based HTTP Client Request

hi im new to effect and trying to start off with a simple http client request. i got the following code for performing a get request:

const getRandomNumberTrivia = (): Promise<NumbersApiResponse> =>
  Effect.runPromise<NumbersApiResponse, HttpClientError.HttpClientError>(
    HttpClientRequest.get("http://numbersapi.com/random/trivia?json").pipe(
      Effect.andThen((res) => res.json),
      Effect.tap(Effect.log),
      Effect.scoped,
      Effect.provide(FetchHttpClient.layer),
    ),
  );


im the following type error:

Argument of type 'Effect<unknown, HttpClientError, never>' is not assignable to parameter of type 'Effect<NumbersApiResponse, HttpClientError, never>'.
  Type 'unknown' is not assignable to type 'NumbersApiResponse'.ts(2345)


since the HttpClientRequest.get method isnt generic, is there still a way to make this resolve the types properly? or do i need to cast the type?
Was this page helpful?