Typescript types for required and optional attributes are not generated correctly #5992
Open
2 of 3 tasks
Labels
feature-request
New feature or enhancement. May require GitHub community feedback.
p2
This is a standard priority issue
queued
This issues is on the AWS team's backlog
Checkboxes for prior research
Describe the bug
Typescript types are for required and optional attributes are not generated corrrectly. I.e. required attributes can accept undefined. And optional attributes cannot accept
undefined
when setting the typescript compilation optionexactOptionalPropertyTypes
totrue
.Fixing this will probably also fix this issue
SDK version number
3.540.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.11.0
Reproduction Steps
Just look at the generated typescript types for all clients
Observed Behavior
Typescript types of required attributes are all generated as a union with their type and
undefined
. And optional attributes are not generated as a union with undefined which gives problems when setting the typescript compilation optionexactOptionalPropertyTypes
totrue
.See for example the in the DynamoDB client the TableName and IndexName attributes in the type QueryInput:
Expected Behavior
I expect required attributes cannot be set to
undefined
while optional attributes can acceptundefined
. Also when setting the typescript compilation optionexactOptionalPropertyTypes
totrue
.So I expected that the generated code for the example above is generated as:
Possible Solution
Probably the following line in DocumentClientCommandGenerator.java:
should be changed to:
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: