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
The behaviour I see during type inference is that either Execute or AutoExecute is set to false. The generated JS code behaves as expected AFAICT. This behaviour changes calling those methods with { execute: true }.
ojongerius
changed the title
get,put,update method type inferrence incorrect when extending Entity
get,put,update method type inference incorrect when extending Entity
Jan 29, 2024
馃憢 I have an issue with extending entities. When extending the Entity class I see the following unexpected behaviour:
The inferred value for the get, put and update methods return {Get,Put,Update>InputCommand instead of {Get,Put,Update}OutputCommand. When I look your code for the get method at https://github.com/jeremydaly/dynamodb-toolbox/blob/main/src/classes/Entity/Entity.ts#L289 I see that return value is defined as:
The behaviour I see during type inference is that either Execute or AutoExecute is set to false. The generated JS code behaves as expected AFAICT. This behaviour changes calling those methods with
{ execute: true }
.As far as I can tell this was introduced by #302 and this behaviour can be changed by changing (https://github.com/jeremydaly/dynamodb-toolbox/blob/main/src/classes/Entity/Entity.ts#L74) from:
to
But obviously a broader fix would be necessary.
Reproduce:
Config:
Using this entity inferred return value looks fine, tested with:
Using TestEntityExtended, we get
Promise<GetCommandInput>
Working around by passing
{ execute: true }
we getPromise<GetOutPutCommand>
and test passesThe text was updated successfully, but these errors were encountered: