lambda-api icon indicating copy to clipboard operation
lambda-api copied to clipboard

Define overloads for LoggerFunction in type definition

Open Sleavely opened this issue 4 years ago • 3 comments
trafficstars

I converted a route to Typescript and things went 💥

Turns out the type definition for the logger methods only expects a string.

This PR makes it behave in accordance with the README

Sleavely avatar Mar 02 '21 16:03 Sleavely

Pull Request Test Coverage Report for Build 289

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.613%

Totals Coverage Status
Change from base Build 285: 0.0%
Covered Lines: 594
Relevant Lines: 595

💛 - Coveralls

coveralls avatar Mar 02 '21 16:03 coveralls

Is there an update on this?

brighttank avatar Jun 09 '21 12:06 brighttank

Needs review/merge by @jeremydaly

Sleavely avatar Jun 10 '21 11:06 Sleavely

Hey @Sleavely, thanks for your contribution, this issue was already resolved in a different PR that I've merged, in addition we allow several params and not only two so this code is not correct.

Again, thanks and sorry for the delayed response 🙏

naorpeled avatar Jan 01 '23 22:01 naorpeled

No worries, I'm just glad the issue is being looked at :)

in addition we allow several params and not only two so this code is not correct.

From what I understand, the base logger supports a dynamic amount of arguments while the actual implementation in the Request object explicitly only accepts two?

https://github.com/jeremydaly/lambda-api/blob/85a8654e3592fde4436cc49919a1b2678a1a3af7/lib/request.js#L54

Sleavely avatar Jan 02 '23 07:01 Sleavely

Hey @Sleavely, I've dug into this a bit further and you're correct, I misunderstood that part in the code, good catch.

I'll be opening a new PR that adds a test case for this and also fix a typo I've found in the doc. Will add you as a co-author, I hope that's okay with you, I want to release a new version today :)

Thank you very much!

naorpeled avatar Jan 13 '23 13:01 naorpeled