Skip to content

Commit

Permalink
Merge pull request #1217 from naorpeled/fix/core/resolve-issues-with-…
Browse files Browse the repository at this point in the history
…type-inference

fix(core)!: resolve type inference issues with input handler
  • Loading branch information
willfarrell authored Jun 24, 2024
2 parents 8d3743e + 226f28e commit aed2cd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ export interface MiddyfiedHandler<
before: AttachMiddlewareFn<TEvent, TResult, TErr, TContext, TInternal>
after: AttachMiddlewareFn<TEvent, TResult, TErr, TContext, TInternal>
onError: AttachMiddlewareFn<TEvent, TResult, TErr, TContext, TInternal>
handler: <TAdditional>(
handler: <TInputHandlerEventProps, TInputHandlerResultProps>(
handler: MiddlewareHandler<
LambdaHandler<TEvent & TAdditional, TResult>,
LambdaHandler<TInputHandlerEventProps, TInputHandlerResultProps>,
TContext
>
) => MiddyfiedHandler<TEvent, TResult, TErr, TContext, TInternal>
| LambdaHandler<TInputHandlerEventProps, TInputHandlerResultProps>
) => MiddyfiedHandler<TInputHandlerEventProps, TInputHandlerResultProps, TErr, TContext, TInternal>
}

declare type AttachMiddlewareFn<
Expand Down
2 changes: 1 addition & 1 deletion packages/core/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,5 @@ const s3Handler: S3Handler = async (event) => {
await Promise.all(event.Records.map(async () => await Promise.resolve()))
}

const handler1182 = middy(s3Handler)
const handler1182 = middy().handler(s3Handler)
expectType<MiddyfiedHandler<S3Event, void, Error, Context, {}>>(handler1182)

0 comments on commit aed2cd3

Please sign in to comment.