Closed
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
After update i cannot use the GetCommand
with DynamoDBDocumentClient anymore. Typescript gives me type errors.
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/lib-dynamodb@3.817.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.14.0
Reproduction Steps
Create a typescript file with contents:
import {DynamoDBClient} from '@aws-sdk/client-dynamodb';
import {DynamoDBDocumentClient, GetCommand} from '@aws-sdk/lib-dynamodb';
const client = DynamoDBDocumentClient.from(
new DynamoDBClient({
apiVersion: '2012-08-10',
region: 'eu-central-1',
endpoint: 'https://dynamodb.eu-central-1.amazonaws.com',
}),
);
const cmd = new GetCommand({
TableName: 'dummy',
Key: {Foo: 'bar'},
});
client.send(cmd)
Observed Behavior
Got typescript error:
src/db/client.ts:17:13 - error TS2345: Argument of type 'GetCommand' is not assignable to parameter of type 'Command<ServiceInputTypes, GetItemCommandInput | GetCommandInput, ServiceOutputTypes, ServiceOutputTypes, SmithyResolvedConfiguration<...>>'.
The types of 'middlewareStack.add' are incompatible between these types.
Type '{ (middleware: InitializeMiddleware<GetItemCommandInput | GetCommandInput, GetItemCommandOutput | GetCommandOutput>, options?: (InitializeHandlerOptions & AbsoluteLocation) | undefined): void; (middleware: SerializeMiddleware<...>, options: SerializeHandlerOptions & AbsoluteLocation): void; (middleware: BuildMiddlew...' is not assignable to type '{ (middleware: InitializeMiddleware<GetItemCommandInput | GetCommandInput, ServiceOutputTypes>, options?: (InitializeHandlerOptions & AbsoluteLocation) | undefined): void; (middleware: SerializeMiddleware<...>, options: SerializeHandlerOptions & AbsoluteLocation): void; (middleware: BuildMiddleware<...>, options: Bu...'.
Types of parameters 'middleware' and 'middleware' are incompatible.
Types of parameters 'context' and 'context' are incompatible.
Type 'import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/middleware").HandlerExecutionContext' is not assignable to type 'import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/middleware").HandlerExecutionContext'.
Types of property '[SMITHY_CONTEXT_KEY]' are incompatible.
Type '{ [key: string]: unknown; service?: string | undefined; operation?: string | undefined; commandInstance?: import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any> | undefined; selectedHttpAuthScheme?: import("/home/jan/...' is not assignable to type '{ [key: string]: unknown; service?: string | undefined; operation?: string | undefined; commandInstance?: import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any> | undefined; selectedHttpAuthScheme?: import("/home/jan/...'.
Type '{ [key: string]: unknown; service?: string | undefined; operation?: string | undefined; commandInstance?: import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any> | undefined; selectedHttpAuthScheme?: import("/home/jan/...' is not assignable to type '{ [key: string]: unknown; service?: string | undefined; operation?: string | undefined; commandInstance?: import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any> | undefined; selectedHttpAuthScheme?: import("/home/jan/...'.
Types of property 'commandInstance' are incompatible.
Type 'import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any> | undefined' is not assignable to type 'import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any> | undefined'.
Type 'import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any>' is not assignable to type 'import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/command").Command<any, any, any, any, any>'.
The types of 'middlewareStack.add' are incompatible between these types.
Type '{ (middleware: import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/middleware").InitializeMiddleware<any, any>, options?: (import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.2.0/node_modules/@smithy/types/dist-types/middleware").Initializ...' is not assignable to type '{ (middleware: import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/middleware").InitializeMiddleware<any, any>, options?: (import("/home/foo/example/node_modules/.pnpm/@smithy+types@4.3.0/node_modules/@smithy/types/dist-types/middleware").Initializ...'.
Types of parameters 'options' and 'options' are incompatible.
Type 'SerializeHandlerOptions & AbsoluteLocation' is not assignable to type '(InitializeHandlerOptions & AbsoluteLocation) | undefined'.
Type 'SerializeHandlerOptions & AbsoluteLocation' is not assignable to type 'InitializeHandlerOptions & AbsoluteLocation'.
Type 'SerializeHandlerOptions & AbsoluteLocation' is not assignable to type 'InitializeHandlerOptions'.
Types of property 'step' are incompatible.
Type '"serialize"' is not assignable to type '"initialize"'.
17 client.send(cmd)
Expected Behavior
No typescript error
Possible Solution
No response
Additional Information/Context
No response