aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Typescript compilation problems since 3.52.0 in lib-dynamodb

Open zackpollard opened this issue 2 years ago • 13 comments

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/[email protected]

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

zackpollard avatar Mar 02 '22 12:03 zackpollard

@zackpollard I started seeing errors but it was when I updated to 3.53.0. My TS works fine in 3.52.0. I wonder if the errors are related, though

My Stack Track
  Argument of type 'ListTablesCommand' is not assignable to parameter of type 'Command<ServiceInputTypes, ListTablesCommandInput, ServiceOutputTypes, ServiceOutputTypes, SmithyResolvedConfiguration<...>>'.
The types of 'middlewareStack.concat' are incompatible between these types.
  Type '<InputType extends ListTablesCommandInput, OutputType extends ListTablesCommandOutput>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<...>' is not assignable to type '<InputType extends ListTablesCommandInput, OutputType extends ServiceOutputTypes>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<...>'.
    Types of parameters 'from' and 'from' are incompatible.
      Type 'MiddlewareStack<InputType, OutputType>' is not assignable to type 'MiddlewareStack<InputType, ListTablesCommandOutput>'.
        Types of property 'addRelativeTo' are incompatible.
          Type '(middleware: MiddlewareType<InputType, OutputType>, options: RelativeMiddlewareOptions) => void' is not assignable to type '(middleware: MiddlewareType<InputType, ListTablesCommandOutput>, options: RelativeMiddlewareOptions) => void'.
            Types of parameters 'middleware' and 'middleware' are incompatible.
              Type 'MiddlewareType<InputType, ListTablesCommandOutput>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
                Type 'InitializeMiddleware<InputType, ListTablesCommandOutput>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
                  Type 'InitializeMiddleware<InputType, ListTablesCommandOutput>' is not assignable to type 'InitializeMiddleware<InputType, OutputType>'.
                    Call signature return types 'InitializeHandler<InputType, ListTablesCommandOutput>' and 'InitializeHandler<InputType, OutputType>' are incompatible.
                      Type 'Promise<InitializeHandlerOutput<ListTablesCommandOutput>>' is not assignable to type 'Promise<InitializeHandlerOutput<OutputType>>'.
                        Type 'InitializeHandlerOutput<ListTablesCommandOutput>' is not assignable to type 'InitializeHandlerOutput<OutputType>'.
                          Types of property 'output' are incompatible.
                            Type 'ListTablesCommandOutput' is not assignable to type 'OutputType'.
                              'ListTablesCommandOutput' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'ServiceOutputTypes'.

jagers avatar Mar 04 '22 23:03 jagers

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:

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

However if I try to add @aws-sdk/[email protected] 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.

cayman-amzn avatar Mar 12 '22 03:03 cayman-amzn

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

jasonwadsworth avatar Mar 30 '22 16:03 jasonwadsworth

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.

WolfWalter avatar Jun 15 '22 08:06 WolfWalter

@zackpollard thanks for opening this issue, is it still a persisting issue with the latest version of the SDK?

ajredniwja avatar Jun 17 '22 14:06 ajredniwja

~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.

jponc avatar Jun 20 '22 00:06 jponc

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

ChristianMaehler avatar Jun 24 '22 06:06 ChristianMaehler

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.

paul-uz avatar Jul 14 '22 15:07 paul-uz

Same issue here using the latest 3.150.0 version of @aws-sdk/lib-dynamodb and @aws-sdk/client-dynamodb.

When I try to send a simple QueryCommand I get the following TS error:

Argument of type 'QueryCommand' is not assignable to parameter of type 'Command<ServiceInputTypes, QueryCommandInput | QueryCommandInput, ServiceOutputTypes, ServiceOutputTypes, SmithyResolvedConfiguration<...>>'.
  The types of 'middlewareStack.addRelativeTo' are incompatible between these types.

adambiggs avatar Aug 17 '22 22:08 adambiggs

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.

adambiggs avatar Aug 17 '22 22:08 adambiggs

I am getting this issue. I had it working with the following packages installed.

    "@aws-sdk/client-dynamodb": "3.128.0",
    "@aws-sdk/client-s3": "3.128.0",
    "@aws-sdk/client-ssm": "3.128.0",
    "@aws-sdk/lib-dynamodb": "3.128.0",

The issue started when I was installing the SQS client, as I decided to update the rest of the packages to 3.163.0. But I was getting errors with aws-sdk-client-mock so I updated that to version 2.0.0 - that led me down a rabbit hole for hours until I reverted both the package.json and package-lock.json files and just re-installed the packages I needed (csv and @aws-sdk/[email protected]). Removing node_modules and reinstalling did nothing until I completely removed node_modules AND I reverted the package-lock.json and package.json files.

I'll do some further digging in a separate branch once I have finished what I'm trying to do first. Seems like some inconsistency somewhere that has been introduced through package-lock.json updates as I've been adding packages and upgrading versions.

Rooster212 avatar Sep 06 '22 14:09 Rooster212

@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.

paul-uz avatar Sep 06 '22 14:09 paul-uz

This issue seems to have been resolved for me after updating to 3.170.0.

adambiggs avatar Sep 14 '22 19:09 adambiggs

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 [email protected] 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/[email protected] 
npm install --save @aws-sdk/[email protected] 
npm install --save-dev [email protected]

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.

timvlaer avatar Nov 29 '22 09:11 timvlaer

@timvlaer 's suggestions mostly worked for me, but boy is this unstable a a solution. I did have to keep the dynamodb dependencies at 3.0.201 while locking everything else to 3.0.208 - matching the version that another dependency (sst) is also locked in on. 🤯

[edit] Code now compiles, but aws-sdk-client-mock (2.0.1) still has type errors in all unit tests, not just DynamoDB.

kernwig avatar Feb 16 '23 01:02 kernwig

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.

kernwig avatar Feb 17 '23 23:02 kernwig

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

julrich1 avatar Feb 17 '23 23:02 julrich1

Hi everyone,

Sorry about this issue falling off the map. I have marked it as high priority. Someone from the team will look into it. Thanks, Ran~

P82075317

RanVaknin avatar Mar 13 '23 20:03 RanVaknin

I'm able to install and compile a specific (not latest) version of the client-dynamodb and lib-dynamodb packages by adding a single override:

  "dependencies": {
    "@aws-sdk/client-dynamodb": "3.287.0",
    "@aws-sdk/lib-dynamodb": "3.287.0"
  },
  "overrides": {
    "@aws-sdk/types": "3.272.0"
  },

The override for @aws-sdk/types should be the version specified in the package.json of the @aws-sdk/client-dynamodb package version that you want to use.

https://github.com/aws/aws-sdk-js-crypto-helpers is released separately from the AWS SDK JSv3, and causes a different version of @aws-sdk/types to be imported when not overridden.


Additionally, if you'd like to use other JSv3 clients other than DynamoDB, you can scope the override in a way that lib and client-dynamodb have the same types version, which is the key requirement.

  "dependencies": {
    "@aws-sdk/client-dynamodb": "3.287.0",
    "@aws-sdk/client-s3": "3.154",
    "@aws-sdk/lib-dynamodb": "3.287.0"
  },
  "overrides": {
    "@aws-sdk/client-dynamodb": {
      "@aws-sdk/types": "3.272.0"
    },
    "@aws-sdk/lib-dynamodb": {
      "@aws-sdk/types": "3.272.0"
    }
  },

(Note: use of clients as old as 3.154.0 is not recommended, this is for demonstration)

import { DynamoDBClient as DynamoClient } from "@aws-sdk/client-dynamodb";
import { S3 } from "@aws-sdk/client-s3";
import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb";

const client = new DynamoClient({});
const ddbDocClient = DynamoDBDocument.from(client);

const s3 = new S3({});

// compiles successfully with v3.287.0 of DynamoDB (plus lib-dynamodb) and v3.154.0 of S3.

Using the same tsconfig.json given above.

kuhe avatar Mar 16 '23 20:03 kuhe

Since this issue was closed, does that mean the types have been fixed?

julrich1 avatar Aug 18 '23 16:08 julrich1

I have just encountered a TypeScript issue with tsyringe and @aws-sdk which I could not resolve...

Type 'new (...[configuration]: [] | [DynamoDBClientConfig]) => DynamoDBClient' is not assignable to type 'new (...args: any[]) => DynamoDBClient'.

Screenshot 2023-08-25 at 9 05 50

florianakos avatar Aug 25 '23 06:08 florianakos

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

github-actions[bot] avatar Sep 09 '23 00:09 github-actions[bot]