Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript definition inconsistent with Lambda funcionality and lambda-api implementation #77

Closed
geovanisouza92 opened this issue Nov 27, 2018 · 3 comments
Labels
Milestone

Comments

@geovanisouza92
Copy link

At this line the definition doesn't accept the callback param, and returns an anemic type, instead of a promise, breaking general TS type checking, forcing the consumers to cast the return or force the callback param.

Beyond that, the typing is not aligned with the examples in README.

@harshit-yadav
Copy link

Any update on this ?

@jeremydaly jeremydaly added the bug label Dec 4, 2018
@jeremydaly
Copy link
Owner

Hi @geovanisouza92, Typescript support was generously added by members of the community.

I can see the issue with the callback, but can you provide more detail regarding the other examples?

@geovanisouza92
Copy link
Author

geovanisouza92 commented Dec 4, 2018

The run method should have the signature:

export default class API {
  // ...

  run(event: APIGatewayEvent, context: Context, cb: (err: Error, result: any) => void): void;
  run(event: APIGatewayEvent, context: Context): Promise<any>;

}

This way it would be aligned with lambda's handler signature and run method functionality.


Porting to TS would be awesome, but there's a mode where TS can automatically emit the signature, while reading from pure JS.

@jeremydaly jeremydaly added this to the v0.10 milestone Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants