From 1baeffb2c455e1dc36b73399b028c2be2beff23f Mon Sep 17 00:00:00 2001 From: jestrjk Date: Wed, 17 Apr 2019 14:10:06 -0400 Subject: [PATCH] Add Null Assertion operator to pathParameters!["route"] Access 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 ``` --- aws-ts-apigateway/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-ts-apigateway/index.ts b/aws-ts-apigateway/index.ts index e98959d35..569a9a36b 100644 --- a/aws-ts-apigateway/index.ts +++ b/aws-ts-apigateway/index.ts @@ -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();