dynamodb-toolbox icon indicating copy to clipboard operation
dynamodb-toolbox copied to clipboard

Please properly type the result of `scan`

Open shellscape opened this issue 3 years ago • 0 comments

At the moment, scan is typed as scan(options?: scanOptions, params?: Partial<DocumentClient.ScanInput>): Promise<any>; That Promise<any> at the end there plays hell with certain tsconfig environments, depending on how someone has their env setup for strictness. We already know from the source https://github.com/jeremydaly/dynamodb-toolbox/blob/09ddf4f144c3119802f44119060138ca5183b46e/src/classes/Table.ts#L685 that the result is either payload or { Items: T }. It would be great to be able to type the result, using a generic and have a properly unioned return type as well. Using any here could be argued bad form.

shellscape avatar Apr 06 '21 14:04 shellscape