Skip to content

Commit 37bd2c5

Browse files
committed
fix queryTableIndex return types
1 parent e438a72 commit 37bd2c5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
QueryCommand,
1313
UpdateItemCommand,
1414
UpdateItemCommandInput,
15+
QueryOutput,
1516
} from '@aws-sdk/client-dynamodb';
1617
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';
1718
import { captureAWSv3Client } from 'aws-xray-sdk-core';
@@ -258,7 +259,7 @@ export async function queryTableIndex(
258259
keyCondExpressionMap?: KeyCondExpressionMap;
259260
filterExpressionMap?: FilterExpressionMap;
260261
},
261-
) {
262+
): Promise<(QueryOutput & { list: any[] }) | null> {
262263
try {
263264
const client = captureAWSv3Client(new DynamoDBClient({}));
264265
let query: QueryCommandInput = {
@@ -308,7 +309,7 @@ export async function queryTableIndex(
308309
}
309310
}
310311
const { Items, ...rest } = await client.send(new QueryCommand(query));
311-
return { list: Items?.length ? Items.map((row) => unmarshall(row)) : [], ...rest };
312+
return { ...rest, list: Items?.length ? Items.map((row) => unmarshall(row)) : [] };
312313
} catch (e) {
313314
console.error(e);
314315
return null;

0 commit comments

Comments
 (0)