Skip to content

Commit

Permalink
Add Null Assertion operator to pathParameters!["route"] Access
Browse files Browse the repository at this point in the history
This is a small change from the previous comments on this issue where as the event variable wasn't the problem, being passed in from the event Handler calling mechanism. It was accessing an untyped(?) event object property `pathParameters` which was causing the TS compile error.

Our ts compiler is slightly different versions mine being:
```
$tsc --version
Version 3.5.0-dev.20190409
```
  • Loading branch information
jestrjk committed Apr 17, 2019
1 parent 7ddb999 commit 1baeffb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws-ts-apigateway/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let endpoint = new awsx.apigateway.API("hello-world", {
path: "/{route+}",
method: "GET",
eventHandler: async (event) => {
let route = event.pathParameters["route"];
let route = event.pathParameters!["route"];
console.log(`Getting count for '${route}'`);

const client = new aws.sdk.DynamoDB.DocumentClient();
Expand Down

0 comments on commit 1baeffb

Please sign in to comment.