Skip to content
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

transform inputs for platform specific type helpers #1046

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Oct 18, 2023

there is a type helper that narrows payload types, currently only for outputs

import { S3 } from "@aws-sdk/client-s3";
import { NodeJsClient } from "@smithy/types";

const s3 = new S3({}) as NodeJsClient<S3>;

await s3.putObject({
    Bucket: '',
    Key: '',
    Body: new Blob() // helper makes this a type error, must use Node.js http(s) payload types like Buffer/Uint8Array/string
})

const get = await s3.getObject({
    Bucket: '',
    Key: ''
});

const body = get.Body; // helper narrows this to SdkStream<IncomingMessage>

this PR adds type narrowing to inputs as well.

@kuhe
Copy link
Contributor Author

kuhe commented Oct 18, 2023

related to aws/aws-sdk-js-v3#5361

@kuhe kuhe merged commit 5e9fd6c into smithy-lang:main Oct 19, 2023
7 checks passed
@kuhe kuhe deleted the feat/types branch October 19, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants