index.d.ts still allows callback based handlers.
everett1992 opened this issue · comments
Describe the bug
The third argument of MiddyInputHandler is documented as callback: () => ...
, but in practice it is { signal: AbortSignal }`.
To Reproduce
const wrapped = middy((e, c, callback) => {
callback satisfies () => void
expect(callback).toEqual({
signal: expect.any(AbortSignal),
})
callback(null, {});
})
return new Promise((resolve, reject) => {
wrapped({}, {}, (err, res) => (err != null) ? reject(err) : resolve(res));
})
Expected behaviour
- Callback handlers should be a type error. Middy never calls the callback argument of a middified handler, and it never calls a wrapped handler with a callback argument.
- The
signal
argument should be documented in the index.d.ts file.