-
Notifications
You must be signed in to change notification settings - Fork 597
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[util-dynamodb] marshall overload signatures are broken due to more general overload matching first #4828
Comments
Hi @pedropedruzzi , Thanks for opening this issue. I'm able to confirm that this is an issue. Will review this with the team. Thanks, |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Reopening, as the fix was reverted in #4909 |
Were there reports of broken types that led to this revert? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Checkboxes for prior research
Describe the bug
A number of fine grained overload signatures were added to the marshall function by PR #3539. In theory this improvement would allow the return of e.g.
marshall(10)
to be detected as having typeAttributeValue.NMember
and so forth.However, this doesn't currently work because the object/map sinature apparently matches
any
type, so the next signatures don't ever get a chance to match.SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.16.0
Reproduction Steps
Just try to tsc the follow TS snippet:
Observed Behavior
The above code fails to TS compile with error
Type 'Record<string, AttributeValue>' is not assignable to type 'AttributeValue'.
because the return is incorrectly detected asRecord<string, AttributeValue>
.Expected Behavior
No TS compilation errors. According to overload signature
export declare function marshall(data: number, options?: marshallOptions): AttributeValue.NMember;
, the callmarshall(10)
should return typeAttributeValue.NMember
instead which is assignable toAttributeValue
.Possible Solution
Rearrange the order of overload signature moving the more general one to the end of the list. Will send a PR shortly.
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: