Skip to content

Commit 295133f

Browse files
committed
Fix Optional Typing for Raw Body
1 parent 12ff836 commit 295133f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/proxyIntegration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type ProxyIntegrationParams = {
99
}
1010

1111
type ProxyIntegrationBody<T = unknown> = {
12-
rawBody: T
12+
rawBody?: T
1313
body: T
1414
}
1515

@@ -97,10 +97,10 @@ export const process: ProcessMethod<ProxyIntegrationConfig, APIGatewayProxyEvent
9797
return null
9898
}
9999

100-
const headers: APIGatewayProxyResult['headers'] = proxyIntegrationConfig.cors ? addCorsHeaders(proxyIntegrationConfig.cors, event) : {};
100+
const headers: (APIGatewayProxyResult['headers'] & {}) = proxyIntegrationConfig.cors ? addCorsHeaders(proxyIntegrationConfig.cors, event) : {};
101101

102102
if (event.httpMethod === 'OPTIONS') {
103-
Object.assign(headers, proxyIntegrationConfig.defaultHeaders)
103+
Object.assign(headers, proxyIntegrationConfig.defaultHeaders ?? {})
104104
return Promise.resolve({
105105
statusCode: 200,
106106
headers,
@@ -155,7 +155,7 @@ export const process: ProcessMethod<ProxyIntegrationConfig, APIGatewayProxyEvent
155155

156156
return convertError(error, errorMapping, headers)
157157
})
158-
} catch (error) {
158+
} catch (error: any) {
159159
console.log('Error while evaluating matching action handler', error)
160160

161161
if (proxyIntegrationConfig.onError) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"types": "index.d.ts",
77
"scripts": {
88
"prepare": "npm run build",
9+
"build:types": "tsc --emitDeclarationOnly",
910
"test": "yarn clean && jest --coverage",
1011
"build": "tsc",
1112
"clean": "rm -f lib/*.d.ts lib/*.js index.js index.d.ts"

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,11 @@ fs.realpath@^1.0.0:
13271327
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
13281328
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
13291329

1330+
fsevents@^2.1.2:
1331+
version "2.3.2"
1332+
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
1333+
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
1334+
13301335
function-bind@^1.1.2:
13311336
version "1.1.2"
13321337
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"

0 commit comments

Comments
 (0)