-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
get,put,update method type inference incorrect when extending Entity #661
Comments
Draft
Pushed demo in #662 |
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
Similar but not identical: #367 |
Related: #683 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
馃憢 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: