aws-sdk-js-v3: Typescript compilation problems since 3.52.0 in lib-dynamodb

Describe the bug

Since lib-dynamodb version 3.52.0 tsc can’t compile the library without compilation issues.

Your environment

SDK version number

@aws-sdk/lib-dynamodb@3.52.0

Is the issue in the browser/Node.js/ReactNative?

Node.js

Details of the browser/Node.js/ReactNative version

v16.7.0

Steps to reproduce

Any code using lib-dynamodb causing tsc to compile the library.

Observed behavior

tsc fails with the following errors
$ tsc -p .\tsconfig.json --noEmit
node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/BatchExecuteStatementCommand.d.ts:33:5 - error TS2416: Property 'resolveMiddleware' in type 'BatchExecuteStatementCommand' is not assignable to the same property in base type 'Command<BatchExecuteStatementCommandInput, BatchExecuteStatementCommandOutput, Dynam
oDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<BatchExecuteStatementCommandInput, BatchExecuteStatementCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

33     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<BatchExecuteStatementCommandInput, BatchExecuteStatementCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/BatchGetCommand.d.ts:44:5 - error TS2416: Property 'resolveMiddleware' in type 'BatchGetCommand' is not assignable to the same property in base type 'Command<BatchGetCommandInput, BatchGetCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<BatchGetCommandInput, BatchGetCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.
        Types of property 'concat' are incompatible.
          Type '<InputType extends any, OutputType extends any>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>' is not assignable to type '<InputType extends ServiceInputTypes, OutputType extends ServiceOutputTypes>(from: MiddlewareStack<InputType, OutputType>) => Middlewar
eStack<...>'.
            Types of parameters 'from' and 'from' are incompatible.
              Type 'MiddlewareStack<InputType, OutputType>' is not assignable to type 'MiddlewareStack<InputType, OutputType | undefined>'.
                Types of property 'concat' are incompatible.
                  Type '<InputType extends InputType, OutputType extends OutputType>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>' is not assignable to type '<InputType extends InputType, OutputType extends OutputType | undefined>(from: MiddlewareStack<InputType, OutputTy
pe>) => MiddlewareStack<InputType, OutputType>'.
                    Types of parameters 'from' and 'from' are incompatible.
                      Type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").MiddlewareStack<InputType, OutputType>' is not assignable to type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_module
s/@aws-sdk/types/dist-types/middleware").MiddlewareStack<InputType, OutputType>'.
                        Types of property 'add' are incompatible.
                          Type '{ (middleware: import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeMiddleware<InputType, OutputType>, options?: (import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/nod
e_modules/@aws-sdk/client-ssm/node...' is not assignable to type '{ (middleware: import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/types/dist-types/middleware").InitializeMiddleware<InputType, OutputType>, options?: (import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/no
de_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerO...'.
                            Types of parameters 'middleware' and 'middleware' are incompatible.
                              Types of parameters 'next' and 'next' are incompatible.
                                Type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandler<InputType, OutputType>' is not assignable to type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api
/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandler<InputType, OutputType>'.
                                  Type 'Promise<import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>>' is not assignable to type 'Promise<import("C:/Users/zackp/Source/moonpig/moonpig-m
emberships-api/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>>'.
                                    Type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>' is not assignable to type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/
node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>'.
                                      Types of property 'output' are incompatible.
                                        Type 'OutputType' is not assignable to type 'OutputType'. Two different types with this name exist, but they are unrelated.
                                          'OutputType' could be instantiated with an arbitrary type which could be unrelated to 'OutputType'.

44     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<BatchGetCommandInput, BatchGetCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/BatchWriteCommand.d.ts:60:5 - error TS2416: Property 'resolveMiddleware' in type 'BatchWriteCommand' is not assignable to the same property in base type 'Command<BatchWriteCommandInput, BatchWriteCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<BatchWriteCommandInput, BatchWriteCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

60     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<BatchWriteCommandInput, BatchWriteCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/DeleteCommand.d.ts:45:5 - error TS2416: Property 'resolveMiddleware' in type 'DeleteCommand' is not assignable to the same property in base type 'Command<DeleteCommandInput, DeleteCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<DeleteCommandInput, DeleteCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

45     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<DeleteCommandInput, DeleteCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/ExecuteStatementCommand.d.ts:29:5 - error TS2416: Property 'resolveMiddleware' in type 'ExecuteStatementCommand' is not assignable to the same property in base type 'Command<ExecuteStatementCommandInput, ExecuteStatementCommandOutput, DynamoDBDocumentClientRes
olvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<ExecuteStatementCommandInput, ExecuteStatementCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

29     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<ExecuteStatementCommandInput, ExecuteStatementCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/ExecuteTransactionCommand.d.ts:33:5 - error TS2416: Property 'resolveMiddleware' in type 'ExecuteTransactionCommand' is not assignable to the same property in base type 'Command<ExecuteTransactionCommandInput, ExecuteTransactionCommandOutput, DynamoDBDocumentC
lientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<ExecuteTransactionCommandInput, ExecuteTransactionCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

33     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<ExecuteTransactionCommandInput, ExecuteTransactionCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/GetCommand.d.ts:31:5 - error TS2416: Property 'resolveMiddleware' in type 'GetCommand' is not assignable to the same property in base type 'Command<GetCommandInput, GetCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<GetCommandInput, GetCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

31     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<GetCommandInput, GetCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/PutCommand.d.ts:45:5 - error TS2416: Property 'resolveMiddleware' in type 'PutCommand' is not assignable to the same property in base type 'Command<PutCommandInput, PutCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<PutCommandInput, PutCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

45     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<PutCommandInput, PutCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/QueryCommand.d.ts:47:5 - error TS2416: Property 'resolveMiddleware' in type 'QueryCommand' is not assignable to the same property in base type 'Command<QueryCommandInput, QueryCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<QueryCommandInput, QueryCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

47     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<QueryCommandInput, QueryCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/ScanCommand.d.ts:42:5 - error TS2416: Property 'resolveMiddleware' in type 'ScanCommand' is not assignable to the same property in base type 'Command<ScanCommandInput, ScanCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<ScanCommandInput, ScanCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

42     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<ScanCommandInput, ScanCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/TransactGetCommand.d.ts:37:5 - error TS2416: Property 'resolveMiddleware' in type 'TransactGetCommand' is not assignable to the same property in base type 'Command<TransactGetCommandInput, TransactGetCommandOutput, DynamoDBDocumentClientResolvedConfig, any, an
y>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<TransactGetCommandInput, TransactGetCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

37     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<TransactGetCommandInput, TransactGetCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/TransactWriteCommand.d.ts:66:5 - error TS2416: Property 'resolveMiddleware' in type 'TransactWriteCommand' is not assignable to the same property in base type 'Command<TransactWriteCommandInput, TransactWriteCommandOutput, DynamoDBDocumentClientResolvedConfig,
 any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<TransactWriteCommandInput, TransactWriteCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

66     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<TransactWriteCommandInput, TransactWriteCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/UpdateCommand.d.ts:50:5 - error TS2416: Property 'resolveMiddleware' in type 'UpdateCommand' is not assignable to the same property in base type 'Command<UpdateCommandInput, UpdateCommandOutput, DynamoDBDocumentClientResolvedConfig, any, any>'.
  Type '(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: HttpHandlerOptions | undefined) => Handler<...>' is not assignable to type '(stack: MiddlewareStack<any, any>, configuration: DynamoDBDocumentClientResolvedConfig, options: a
ny) => Handler<UpdateCommandInput, UpdateCommandOutput>'.
    Types of parameters 'clientStack' and 'stack' are incompatible.
      Type 'MiddlewareStack<any, any>' is not assignable to type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>'.

50     resolveMiddleware(clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, configuration: DynamoDBDocumentClientResolvedConfig, options?: __HttpHandlerOptions): Handler<UpdateCommandInput, UpdateCommandOutput>;
       ~~~~~~~~~~~~~~~~~

node_modules/@aws-sdk/lib-dynamodb/dist-types/pagination/Interfaces.d.ts:4:18 - error TS2430: Interface 'DynamoDBDocumentPaginationConfiguration' incorrectly extends interface 'PaginationConfiguration'.
  Types of property 'client' are incompatible.
    Type 'DynamoDBDocumentClient | DynamoDBDocument' is not assignable to type 'Client<any, any, any>'.
      Type 'DynamoDBDocumentClient' is not assignable to type 'Client<any, any, any>'.
        The types of 'middlewareStack.concat' are incompatible between these types.
          Type '<InputType extends ServiceInputTypes, OutputType extends ServiceOutputTypes>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<...>' is not assignable to type '<InputType extends any, OutputType extends any>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, 
OutputType>'.
            Types of parameters 'from' and 'from' are incompatible.
              Type 'MiddlewareStack<InputType, OutputType>' is not assignable to type 'MiddlewareStack<InputType, ServiceOutputTypes>'.
                Types of property 'concat' are incompatible.
                  Type '<InputType extends InputType, OutputType extends OutputType>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>' is not assignable to type '<InputType extends InputType, OutputType extends ServiceOutputTypes>(from: MiddlewareStack<InputType, OutputType>)
 => MiddlewareStack<InputType, OutputType>'.
                    Types of parameters 'from' and 'from' are incompatible.
                      Type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").MiddlewareStack<InputType, OutputType>' is not assignable to type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_module
s/@aws-sdk/types/dist-types/middleware").MiddlewareStack<InputType, OutputType>'.
                        Types of property 'add' are incompatible.
                          Type '{ (middleware: import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeMiddleware<InputType, OutputType>, options?: (import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/nod
e_modules/@aws-sdk/client-ssm/node...' is not assignable to type '{ (middleware: import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/types/dist-types/middleware").InitializeMiddleware<InputType, OutputType>, options?: (import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/no
de_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerO...'.
                            Types of parameters 'middleware' and 'middleware' are incompatible.
                              Types of parameters 'next' and 'next' are incompatible.
                                Type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandler<InputType, OutputType>' is not assignable to type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api
/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandler<InputType, OutputType>'.
                                  Type 'Promise<import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>>' is not assignable to type 'Promise<import("C:/Users/zackp/Source/moonpig/moonpig-m
emberships-api/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>>'.
                                    Type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>' is not assignable to type 'import("C:/Users/zackp/Source/moonpig/moonpig-memberships-api/
node_modules/@aws-sdk/types/dist-types/middleware").InitializeHandlerOutput<OutputType>'.
                                      Types of property 'output' are incompatible.
                                        Type 'OutputType' is not assignable to type 'OutputType'. Two different types with this name exist, but they are unrelated.
                                          'OutputType' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'any'.

4 export interface DynamoDBDocumentPaginationConfiguration extends PaginationConfiguration {
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 14 errors in 14 files.

Errors  Files
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/BatchExecuteStatementCommand.d.ts:33
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/BatchWriteCommand.d.ts:60
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/DeleteCommand.d.ts:45
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/ExecuteStatementCommand.d.ts:29
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/ExecuteTransactionCommand.d.ts:33
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/GetCommand.d.ts:31
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/PutCommand.d.ts:45
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/QueryCommand.d.ts:47
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/ScanCommand.d.ts:42
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/TransactGetCommand.d.ts:37
     1  node_modules/@aws-sdk/lib-dynamodb/dist-types/commands/TransactWriteCommand.d.ts:66

Expected behavior

tsc should compile

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 21
  • Comments: 22 (3 by maintainers)

Most upvoted comments

Deleting node_modules and package-lock.json, and running npm i did the trick for me.

We had the same issue. Problem was that we also have @aws-amplify in our monorepo and TS was using @aws-sdk/smithy-client 3.6.1 from amplify. By adding a modern version of @aws-sdk/smithy-client as a dependency, the issue was resolved for us.

I started having this issue when I had to downgrade the @aws-sdk/client-dynamodb dependency because of #4222 . I downgraded both client-dynamodb and lib-dynamodb to 3.208.0.

I encountered this particular issue before. I usually remove node_modules and package-lock.json and install the latest version of the sdk. But that didn’t help in this case as I needed a specific version to work around another issue.

@WolfWalter lead me to the smithy-client (npm list @aws-sdk/smithy-client) It turned indeed out that version 2.215.0 was there and clashed with my own installed (and preferred) 3.208.0.

I use aws-sdk-client-mock@0.6.2 as a dev dependency for my unit tests and it has a peer dependency on "@aws-sdk/client-s3": "^3.0.0" which takes 3.218.0 as a version and 3.215 as a smithy version. These are the latest versions at the moment of writing. These versions are obviously conflicting with the versions I actually want. (This also explains why it usually works when I upgrade my aws sdk dependencies to the latest version. The latest version will be the same as the one aws-sdk-client-mock selects.)

So I started looking for an dynamodb dependency that’s compatible… I ended up with which did the trick.

npm install --save @aws-sdk/client-dynamodb@3.201.0 
npm install --save @aws-sdk/lib-dynamodb@3.201.0 
npm install --save-dev aws-sdk-client-mock@0.6.2

I dug a little deeper: it’s also worthwhile to try upgrading aws-sdk-client-mock to 2.0.1 as it doesn’t have the peer dependency anymore (since 1.0.0, but that version introduced jest matchers and I don’t need jest. Jest is moved in 2.0.0).

After I did that upgrade, I tried aws-sdk 3.208.0 again and it works like a charm now.

Long story short (I hope it helps anyone here):

  • check your other dependencies that have a (peer) dependency on the AWS SDK. An easy way to figure that out is by checking that smithy-client as it seems to come with every module of the sdk
  • if you use aws-sdk-client-mock, upgrade it to the latest version

As far as I understand it, this issue seems always caused by several different versions of the AWS sdk installed.

It looks like the issue was introduced somewhere between 3.105.0 and 3.109.0 (the versions in between those don’t exist on npm). 3.105.0 is the latest version I can get to work without any type errors.

Got it working. I had to audit all @aws-sdk dependencies in package-lock.json, determine the highest version of each up to v3.208.0 (what a dependency I’m using locks in at), and set the overrides in my root package.json to ensure nothing newer is pulled in. Obviously, this is a maintenance nightmare.

  "overrides": {
    "@aws-sdk/abort-controller": "3.208.0",
    "@aws-sdk/chunked-blob-reader": "3.188.0",
    "@aws-sdk/client-apigatewaymanagementapi": "3.208.0",
    "@aws-sdk/client-cloudwatch": "3.208.0",
    "@aws-sdk/client-cognito-identity-provider": "3.208.0",
    "@aws-sdk/client-dynamodb": "3.208.0",
    "@aws-sdk/client-iot": "3.208.0",
    "@aws-sdk/client-iot-data-plane": "3.208.0",
    "@aws-sdk/client-lambda": "3.208.0",
    "@aws-sdk/client-pinpoint": "3.208.0",
    "@aws-sdk/client-s3": "3.208.0",
    "@aws-sdk/client-ses": "3.208.0",
    "@aws-sdk/client-sns": "3.208.0",
    "@aws-sdk/client-sqs": "3.208.0",
    "@aws-sdk/client-ssm": "3.208.0",
    "@aws-sdk/is-array-buffer": "3.201.0",
    "@aws-sdk/lib-dynamodb": "3.208.0",
    "@aws-sdk/querystring-parser": "3.208.0",
    "@aws-sdk/signature-v4": "3.208.0",
    "@aws-sdk/signature-v4-crt": "3.208.0",
    "@aws-sdk/types": "3.208.0",
    "@aws-sdk/util-body-length-browser": "3.188.0",
    "@aws-sdk/util-hex-encoding": "3.201.0",
    "@aws-sdk/util-locate-window": "3.208.0",
    "@aws-sdk/util-middleware": "3.208.0",
    "@aws-sdk/util-uri-escape": "3.201.0",
    "@aws-sdk/util-utf8": "3.208.0",
    "@aws-sdk/util-utf8-browser": "3.188.0",
    "@aws-sdk/xml-builder": "3.201.0"
  }

The cause appears to be some loose dependencies that assume that future minor version releases will be backward compatible. They depend on has one of these as “@aws-sdk/signature-v4-crt”: “^3.31.0”, - the ^ means it pulls in the latest minor version rather than 3.208.0 like all the other aws-sdk dependences.

Three culprits are: @aws-crypto/crc32, @aws-crypto/sha1-browser, and aws-crt. They all have dependencies on @aws-sdk libraries with caret/hat/^ version specifiers, which means they pull in the latest minor version rather than the locked in 3.208.0. (One of them does this to @aws-sdk/types, which is what caused me the most trouble with lib-dynamodb and aws-sdk-client-mock.)

Shouldn’t be a problem so long as you and all of your dependencies use the ^ syntax to pull the latest. Once a specific version is chosen, incompatibilities ensue.

~It’s still causing issues @ajredniwja . Currently running ^3.113.0~

Nevermind, it’s working fine for me, I just have to update both @aws-sdk/client-dynamodb and @aws-sdk/lib-dynamodb to the same version number and it’s now working for me.

These two issues are similar and possibly duplicates. https://github.com/aws/aws-sdk-js-v3/discussions/4261

@Rooster212 yea, removing node_modules didn’t do anything because the versions were still locked in package.lock.json. Conversely, if you just delete package.lock.json and not node_modules, NPM will install the version in the modules folder.

I am getting the error:

Argument of type 'ScanCommand' is not assignable to parameter of type 'Command<ServiceInputTypes, ScanCommandInput, ServiceOutputTypes, ScanCommandOutput, SmithyResolvedConfiguration<HttpHandlerOptions>>'.

When trying to compile TS, with lib-dynamodb and client-dynamodb on 3.128.0.

Same issue here. I tried all the adaptations described in the comments above, but none of them worked.

I might be an edge case but though I would comment anyways in case it helps:

I was getting a similar conflict issue with the DynamoDBDocumentClient & GetCommand with these versions:

  • @aws-sdk/types@3.53.0
  • @aws-sdk/lib-dynamodb@3.53.0
  • @aws-sdk/client-dynamodb@3.53.0

I removed my @aws-sdk/types dependency and now it works… ¯\_(ツ)_/¯

However if I try to add @aws-sdk/types@3.53.0 back in, I cannot reproduce the same conflict error…

Maybe try wiping node_modules and reinstalling?:

rm -rfd ./node_modules/ package-lock.json && \
npm i --save @aws-sdk/types @aws-sdk/lib-dynamodb @aws-sdk/client-dynamodb

If that command fixes your issue then I would think something wrong happened in the publishing/updating phase of this repo. Looking at change logs it doesn’t look like much changed though for these packages so I’m not convinced of that.