Closed jedwards1211 closed 2 days ago
We don't plan to change the order of the docstrings at this time.
terminology:
To reach the modeled type faster:
XCommand
class.XCommandInput
or XCommandOutput
types.Alternative:
Why do the XCommandInput/Output
types exists?
import { XCommand, XCommandInput, XCommandOutput } from "...";
const input: XCommandInput = {}; const output: XCommandOutput = await client.send(new XCommand(input));
- To allow modifications. The SDK transforms certain modeled types to make them easier to use. For example, in the AWS SDK S3 Client, the output type is
```ts
/**
* @public
*
* The output of {@link GetObjectCommand}.
*/
export interface GetObjectCommandOutput extends Omit<GetObjectOutput, "Body">, __MetadataBearer {
Body?: StreamingBlobPayloadOutputTypes;
}
to attach additional methods on the Body
field for transforming it to a string or other stream types.
Autocompleting a field is okay when I'm already typing out the command. But it seems like fairly often I want to look at the fields before I've started typing the call, and then it's an unpleasant dev experience. Cmd-Click on the command brings up the declaration selector thing so it's an additional step to open the file. Always feels like it breaks my flow. I guess with practice I'll get faster at it but I'm disappointed you don't want to invest in making it more direct.
Hmmm, maybe I'm wrong about the duplicate declaration selector, maybe that was happening while I was experimenting with restructuring the definitions?
Anyway, if you've ever dealt with something that felt petty to complain about, yet has bothered you enough that it would feel dissatisfying to accept that it's always going to be that way, this is one of those experiences for me.
We try to support 3 ways to find information about SDK operation input and output types:
new S3({}).getObject({ ... });
For option 1, which you are using, we may be able to move the types closer to the entry point. I'll open a PR with what I find.
Oh nice, I didn't think to propose static field declarations. I think that would help me, thank you!
This will take some time to deploy (if approved) due to the review process and other higher priority issues.
Okay makes sense, thanks :)
closed the issue but it's pending a code generation update in https://github.com/aws/aws-sdk-js-v3 which may take another week or so
awesome, thanks!
The smithy-generated typedefs have several layers of indirection that make it tedious to navigate from a command to its input/output types.
For example, let's say I want to get to the input type for
DescribeInstancesCommand
:DescribeInstancesCommand
class DescribeInstancesCommand extends DescribeInstancesCommand_base { }
DescribeInstancesCommand_base
const DescribeInstancesCommand_base
withnew (input: DescribeInstancesCommandInput)
DescribeInstancesCommandInput
interface DescribeInstancesCommandInput extends DescribeInstancesRequest { }
DescribeInstancesRequest
That's four Cmd-Clicks; after working with the TypeScript SDK for awhile, this has become persistently annoying. I'd rather it took just two Cmd-Clicks: one to get to the
DescribeInstancesCommand
declaration, and one to get to the type containing all of the input or output properties.All of the AWS SDK Commands I've dealt with have a pattern like this:
I don't know what purpose the distinction between
*Command
/*Command_base
or*CommandInput
/*Request
or*CommandOutput
/*Result
was designed for, but it's hard to understand what benefits it has in practice, that would outweigh the drawbacks of cumbersome navigation.The following would be better for us to work with, and AFAIK have the same types:
At the very least, it would be helpful to have links to the
*Request
/*Result
at the very bottom of the docstring for*Command
:Putting them at the bottom would ensure we don't have to scroll up to find them after jumping to the
*Command
type.