TypeScript Issue with Effect-HTTP Client Module: 'Unknown' and 'Never' Type Clash

[effect-http] I'm having some typescript issues with the Client module, I've looked at examples and can't pinpoint the issue. For some reason the Requirements of the effect are types as "unknown" and clash with "never" when I try to run it. But I can't figure out how they end up as unknown:

const client = Client.make(api, { baseUrl: "https://api.dune.com/api" })

client.latestQueryResults({
  path: {
    queryId: 3931757
  },
  query: {
    limit: 10
  },
  headers: {
    "X-DUNE-API-KEY": process.env.DUNE_API_KEY!
  }
}).pipe(
  Effect.flatMap(Console.log),
  Effect.runPromise
)


src/scripts/pad.ts:22:38 - error TS2345: Argument of type '<A, E>(effect: Effect<A, E, never>, options?: { readonly signal?: AbortSignal | undefined; } | undefined) => Promise<A>' is not assignable to parameter of type '(_: Effect<void, ClientError<number>, unknown>) => Promise<void>'.
  Types of parameters 'effect' and '_' are incompatible.
    Type 'Effect<void, ClientError<number>, unknown>' is not assignable to type 'Effect<void, ClientError<number>, never>'.
      Type 'unknown' is not assignable to type 'never'.

22   .pipe(Effect.flatMap(Console.log), Effect.runPromise);


Full code can be seen here: https://github.com/mento-protocol/minipay-airdrop/blob/main/src/scripts/pad.ts
Was this page helpful?