Skip to content

Type 'DynamoDBClient' does not satisfy the constraint 'SmithyClient'. #1803

Closed
@treefrog00

Description

@treefrog00

Describe the bug
I'm not using the waiters code, but running "tsc" on a project using @aws-sdk/client-dynamodb throws this error:

yarn run v1.22.4
$ tsc
node_modules/@aws-sdk/client-dynamodb/types/waiters/waitForTableExists.d.ts:9:71 - error TS2344: Type 'DynamoDBClient' does not satisfy the constraint 'SmithyClient'.
  The types of 'middlewareStack.concat' are incompatible between these types.
    Type '<InputType extends ServiceInputTypes, OutputType extends ServiceOutputTypes>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>' 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 'addRelativeTo' are incompatible.
            Type '(middleware: MiddlewareType<InputType, OutputType>, options: RelativeMiddlewareOptions) => void' is not assignable to type '(middleware: MiddlewareType<InputType, ServiceOutputTypes>, options: RelativeMiddlewareOptions) => void'.
              Types of parameters 'middleware' and 'middleware' are incompatible.
                Type 'MiddlewareType<InputType, ServiceOutputTypes>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
                  Type 'InitializeMiddleware<InputType, ServiceOutputTypes>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
                    Type 'InitializeMiddleware<InputType, ServiceOutputTypes>' is not assignable to type 'InitializeMiddleware<InputType, OutputType>'.
                      Call signature return types 'InitializeHandler<InputType, ServiceOutputTypes>' and 'InitializeHandler<InputType, OutputType>' are incompatible.
                        Type 'Promise<InitializeHandlerOutput<ServiceOutputTypes>>' is not assignable to type 'Promise<InitializeHandlerOutput<OutputType>>'.
                          Type 'InitializeHandlerOutput<ServiceOutputTypes>' is not assignable to type 'InitializeHandlerOutput<OutputType>'.
                            Types of property 'output' are incompatible.
                              Type 'ServiceOutputTypes' is not assignable to type 'OutputType'.
                                'ServiceOutputTypes' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'any'.
                                  Type 'MetadataBearer' is not assignable to type 'OutputType'.
                                    'MetadataBearer' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'any'.

Maybe the SDK doesn't work with older versions of typescript or something.

SDK version number

3.0.0

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

Node.js

Details of the browser/Node.js/ReactNative version
Paste output of npx envinfo --browsers or node -v or react-native -v

node is v12.18.2

But maybe more useful is that typescript is 3.8.3

To Reproduce (observed behavior)
Given I haven't used the waiters code I wonder if just the include would cause it to fail, but this is approximately my code:

import { DynamoDB, GetItemCommand } from '@aws-sdk/client-dynamodb';
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb';

const client = new DynamoDB({ region: 'eu-west-1' });
const command = new GetItemCommand({
    TableName: 'foo',
    Key: marshall({ myKey: "hello" }),
  });
  const { Item } = await client.send(command)
}

Expected behavior
It compiles.

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions