Type Alias Request<TEvent, TResult, TErr, TContext>
Request: { context: TContext; error: TErr | null; event: TEvent; internal: { [key: string]: unknown }; response: TResult | null;} Type Parameters
- TEvent = unknown
- TResult = unknown
- TErr = Error
- TContext extends Context = Context
Type declaration
error: TErr | null
internal: { [key: string]: unknown }
response: TResult | null
This type represents the shape of a Middy.js request object.
We need to define these types and interfaces here because we can't import them from Middy.js.
Importing them from Middy.js would introduce a dependency on it, which we don't want because we want to keep it as an optional dependency.
Those users who don't use the Powertools for AWS Lambda (TypeScript) middleware and use
tsc
to compile their code will get an error if we import them directly, see #1068.Given that we use a subset of Middy.js types, we can define them here and avoid the dependency.