feat(types): improve streaming payload types #835
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes aws/aws-sdk-js-v3#4933
JSv3 codegen diff: aws/aws-sdk-js-v3#4987
This PR replaces manually constructed unions in streaming payloads with an alias type that has attached explanatory documentation.
Old Streaming input/output types:
Note the blob type's base type is
Readable | Blob | ReadableStream
, making the full union of the input:string | Uint8Array | Buffer | Readable | Blob | ReadableStream
.The problem with these inlined unions is that it isn't clear why the type is so wide, and what types are truly compatible with a particular streaming payload.
New streaming intput/output types:
The type union aliases provide a description of the union contents, why they are typed this way, and when you might want to use each union member.