effect-app / libs

The core libraries to build apps with Effect
44 stars 6 forks source link

fix: express use() return type #31

Closed NexZhu closed 1 year ago

NexZhu commented 1 year ago

Fix wrong return type of use function in: https://github.com/effect-ts-app/libs/blob/d807a8ec102d017930bfbed2c89139a0c49d048c/packages/infra-adapters/_src/express.ts#L327-L346


export function use<
  Handlers extends NonEmptyArguments<EffectRequestHandler<any, any, any, any, any, any>>
>(
  ...handlers: Handlers
): Effect<
  & ExpressEnv // #L327-328 should be a wrong type
  & _R<
    {
      [k in keyof Handlers]: [Handlers[k]] extends [
        EffectRequestHandler<infer R, any, any, any, any, any>
      ] ? Effect<R, never, void>
        : never
    }[number]
  >,
  never,
  void
>
export function use<
  Handlers extends NonEmptyArguments<EffectRequestHandler<any, any, any, any, any, any>>
>(
  path: PathParams,
  ...handlers: Handlers
): Effect<
  | ExpressEnv // #L345-346 should be the correct type
  | _R<
    {
      [k in keyof Handlers]: [Handlers[k]] extends [
        EffectRequestHandler<infer R, any, any, any, any, any>
      ] ? Effect<R, never, void>
        : never
    }[number]
  >,
  never,
  void
>
···