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
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 type AttributeValue.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/util-dynamodb@3.350.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
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 as Record<string, AttributeValue>.
Expected Behavior
No TS compilation errors. According to overload signature export declare function marshall(data: number, options?: marshallOptions): AttributeValue.NMember;, the call marshall(10) should return type AttributeValue.NMember instead which is assignable to AttributeValue.
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:
RanVaknin
added
needs-review
This issue/pr needs review from an internal developer.
p2
This is a standard priority issue
queued
This issues is on the AWS team's backlog
and removed
needs-triage
This issue or PR still needs to be triaged.
needs-review
This issue/pr needs review from an internal developer.
labels
Jun 13, 2023
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/util-dynamodb@3.350.0
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: