Skip to content

Commit ba5cd7a

Browse files
committed
updated package.json, readme tweaks.
1 parent 364e02c commit ba5cd7a

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type Handler<TEvent = any, TResult = any> = (
1616
This is technically correct, but as users of the library, it doesn't represent the functions we are supposed to write:
1717

1818
* If we use the callback approach, we should never return a Promise, and
19-
* If we do want to write our handler as an async method then
19+
* If we write an async handler, then
2020
* The callback parameter shouldn't even exist and
2121
* The return type should only be a Promise, and not void | Promise
2222

@@ -31,17 +31,20 @@ Writing tests is now difficult. We get the following types of errors:
3131
// main.test.ts
3232
it.('should work', async (done) => {
3333

34-
let actual: MyResult = await myHandler(myEvent, myContext); // Expected 3 arguments, but got 2.
35-
// ^^^ Type 'MyResult | void' is not assignable to type 'MyResult'.
34+
let actual: MyResult = await myHandler(myEvent, myContext);
35+
// 1. Expected 3 arguments, but got 2.
36+
// 2. Type 'MyResult | void' is not assignable to type 'MyResult'.
3637
});
3738
```
3839

40+
----
41+
3942
## The Solution
4043

4144
This module exports 2 utility types, `SyncHandler` and `AsyncHandler`, that transform the handlers from [@types/aws-lambda](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda) into the types that are intended to be implemented. It also reexports everything from [@types/aws-lambda](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda) for convenience.
4245

43-
### Examples
44-
```Typescript
46+
### Example
47+
```typescript
4548
import {AsyncHandler, SyncHandler, APIGatewayProxyHandler} from "aws-lambda-consumer"
4649

4750
// (event: APIGatewayProxyEvent, context: Context, callback: Callback<APIGatewayProxyResult>) => void

package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{
22
"name": "aws-lambda-consumer",
3-
"version": "1.0.0-alpha",
4-
"description": "",
3+
"version": "1.0.0",
4+
"description": "Typescript types that transform the handler function types from @types/aws-lambda into the stricter synchronous and asynchronous signatures that are intended to be implemented",
5+
"publishConfig": {
6+
"registry": "https://registry.npmjs.org"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/trevor-leach/aws-lambda-consumer.git"
11+
},
12+
"keywords": ["typescript", "aws-lambda", "aws", "lambda", "types"],
513
"author": {
614
"name": "Trevor Leach",
715
"email": "r33fshark-github@yahoo.com",
@@ -13,8 +21,8 @@
1321
],
1422
"scripts": {
1523
"clean": "rm -rf ./dist",
16-
"build": "npx tsc",
17-
"test": "npx tsd"
24+
"build": "tsc",
25+
"test": "tsd"
1826
},
1927
"license": "ISC",
2028
"dependencies": {

0 commit comments

Comments
 (0)