You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! We were using Command and it was working with version 2.x.x and right now after updating to version 3.0.0. Is failing. I've tried to understand why, but I don't understand what happen. Can you explain me what I have to change to migrate to the newest version?
We have a generic class that uses Command from your package
export class DynamoQueryBuilderCommand<T extends Command<any, any, any, any, any>> {
private readonly commandFactory: CommandFactory<T>;
constructor(commandFactory: CommandFactory<T>) {
this.commandFactory = once(commandFactory); // once is
}
....
}
export type CommandFactory<T extends Command<any, any, any, any, any>> = () => T | Promise<T>;
function once<T extends (...args: any[]) => any>(fn: T): T {
let called = false;
let result: ReturnType<T> | undefined;
return function (this: any, ...args: Parameters<T>): ReturnType<T> {
if (!called) {
called = true;
result = fn.apply(this, args);
}
return result as ReturnType<T>;
} as T;
}
We are calling it from different classes.
import { GetCommand } from '@aws-sdk/lib-dynamodb';
export class DynamoQueryBuilder {
// constructor and other methods
findOneById(id: string): DynamoQueryBuilderCommand<GetCommand> { // This was working and right now it fails
const command: GetCommandInput = {
TableName: this.tableName,
Key: id),
};
return new DynamoQueryBuilderCommand(() => new GetCommand(command));
}
}
We are having the following issue:
Dynamo-query-builder.ts:- error TS2344: Type 'GetCommand' does not satisfy the constraint 'Command<any, any, any, any, any>'.
The types of 'middlewareStack.concat' are incompatible between these types.
Type '<InputType extends GetItemCommandInput | GetCommandInput, OutputType extends GetItemCommandOutput | GetCommandOutput>(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, GetItemCommandOutput | GetCommandOutput>'.
Types of property 'addRelativeTo' are incompatible.
Type '(middleware: MiddlewareType<InputType, OutputType>, options: RelativeMiddlewareOptions) => void' is not assignable to type '(middleware: MiddlewareType<InputType, GetItemCommandOutput | GetCommandOutput>, options: RelativeMiddlewareOptions) => void'.
Types of parameters 'middleware' and 'middleware' are incompatible.
Type 'MiddlewareType<InputType, GetItemCommandOutput | GetCommandOutput>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
Type 'InitializeMiddleware<InputType, GetItemCommandOutput | GetCommandOutput>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
Type 'InitializeMiddleware<InputType, GetItemCommandOutput | GetCommandOutput>' is not assignable to type 'InitializeMiddleware<InputType, OutputType>'.
Call signature return types 'InitializeHandler<InputType, GetItemCommandOutput | GetCommandOutput>' and 'InitializeHandler<InputType, OutputType>' are incompatible.
Type 'Promise<InitializeHandlerOutput<GetItemCommandOutput | GetCommandOutput>>' is not assignable to type 'Promise<InitializeHandlerOutput<OutputType>>'.
Type 'InitializeHandlerOutput<GetItemCommandOutput | GetCommandOutput>' is not assignable to type 'InitializeHandlerOutput<OutputType>'.
Types of property 'output' are incompatible.
Type 'GetItemCommandOutput | GetCommandOutput' is not assignable to type 'OutputType'.
'GetItemCommandOutput | GetCommandOutput' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'any'.
Type 'GetItemCommandOutput' is not assignable to type 'OutputType'.
'GetItemCommandOutput' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'any'.
44 findOneById(id: StrictUnion<PrimaryKey>): DynamoQueryBuilderCommand<GetCommand> {
~~~~~~~~~~
src/dynamo/dynamo-query-builder.ts:50:5 - error TS2322: Type 'DynamoQueryBuilderCommand<Command<any, any, any, any, any>>' is not assignable to type 'DynamoQueryBuilderCommand<GetCommand>'.
Type 'Command<any, any, any, any, any>' is missing the following properties from type 'GetCommand': inputKeyNodes, outputKeyNodes, clientCommand, addMarshallingMiddleware, resolveMiddlewareWithContext
50 return new DynamoQueryBuilderCommand(() => new GetCommand(command));
~~~~~~
Reading the docs I see the new version is for node16 support, so I don't understand whats going on. Any idea how to solve this issue? It is really wanted? Many thanks!
The text was updated successfully, but these errors were encountered:
For us this was caused by multiple versions of the @smithy/types package. Make sure you're using v3 everywhere, including in deps of deps where possible (you may have to upgrade other AWS deps).
@jsapes, like @danewilson mentioned this is probably due to inconsistent usage of dependencies (we released a major version bump to support Node 16 as a minimum version from Node 14).
Could you try updating the dependencies to the latest version and seeing if that works?
Hi! We were using Command and it was working with version 2.x.x and right now after updating to version 3.0.0. Is failing. I've tried to understand why, but I don't understand what happen. Can you explain me what I have to change to migrate to the newest version?
We have a generic class that uses Command from your package
We are calling it from different classes.
We are having the following issue:
Reading the docs I see the new version is for node16 support, so I don't understand whats going on. Any idea how to solve this issue? It is really wanted? Many thanks!
The text was updated successfully, but these errors were encountered: