https://serverless-stack.com/ logo
#random
Title
# random
s

Sean Matheson

03/17/2022, 9:46 PM
Been playing around with a typesafe middleware pattern for my lambdas...
Still a work in progress, but feels like it's heading the right direction.
f

Frank

03/17/2022, 11:31 PM
big big fan of ur commenting style
t

thdxr

03/18/2022, 4:02 AM
great work, always love clever uses of ts inference
a

Adrián Mouly

03/18/2022, 4:08 AM
Why not using middy?
t

thdxr

03/18/2022, 4:37 AM
also another approach idk if you've considered is you can have the callback return just the fields it wants to add and you merge it in - then you could use inference to get that type instead of requiring them to pass it
r

Ross Coundon

03/18/2022, 7:47 AM
Interesting, how’s the
lambda()
function defined?
s

Sean Matheson

03/18/2022, 8:46 AM
@Adrián Mouly I'm not a fan of the Middy API and found it hard to type.
@thdxr I'll play with that idea, ta for the tip. would be amazing to utilise full inference.
@Ross Coundon I'll happily share the source once I've gotten it past the rough prototype stage