-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Description
After upgrading @aws-sdk/* package(s) to a newer version, the mockClient() function throws type errors similar to this:
TS2345: Argument of type 'typeof DynamoDBDocumentClient' is not assignable to parameter of type 'InstanceOrClassType<Client<ServiceInputTypes, MetadataBearer, any>>'.
Type 'typeof DynamoDBDocumentClient' is not assignable to type 'ClassType<Client<ServiceInputTypes, MetadataBearer, any>>'.
The types of 'prototype.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 ServiceInputTypes, OutputType extends MetadataBearer>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>'.
Types of parameters 'from' and 'from' are incompatible.
Property 'identify' is missing in type 'MiddlewareStack<InputType, OutputType>' but required in type 'MiddlewareStack<InputType, ServiceOutputTypes>'.
In 99% of cases, this is not a problem with type incompatibility between @aws-sdk/* and aws-sdk-client-mock, but a resolut of having multiple versions of @smithy/types package installed.
Follow those steps to solve it
Go through the steps until one works:
Run npm ls @smithy/types / pnpm why @smithy/types / yarn why @smithy/types
and check if you have more than one version of the package installed.
Go through the steps until one works:
- make sure all your
@aws-sdk/*packages point to the same version, - remove all
@aws-sdk/*packages frompackage.json, runnpm install/pnpm install/yarn install, restore@aws-sdk/*packages inpackage.json, and run install again, - add
@smithy/typesto your dev dependencies in the latest version, - force using single
@smithy/typesversion with npm overrides, pnpm overrides, or yarn resolutions, - if nothing else helped, open an issue including the output of
npm ls @smithy/types/pnpm why @smithy/types/yarn why @smithy/types.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels