-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Dynamo DocumentClient is not exposed in TypeScript definitions #1233
Comments
@midknight41 You're welcome to submit a PR, but I think this falls under the generated typings so it is something we'd want to tackle in a generic way (we likely have the same problem for S3.ManagedUpload as well. |
There are two issues here actually. I've defined it badly.
I'll have a peek at the other issue first I think. |
Other semi related problems are some interfaces are not exported:
|
@sgtoj |
Thanks... You're correct. I was using @types/aws-sdk before types definition were added (v2.7.0?) to the package. Those definitions from DefinitelyType has it defined differently. |
There is quite a lot of variation between the DefinitelyTyped ones and the ones AWS are producing. There will be lots of breaking changes but, ultimately, the definitions here will be a lot better and maintained better. |
That is my hope. I wasn't aware of the packaged types so I used the DefinitelyTyped one. That is until today. I will be using the native definition from this point forward. |
@midknight41 Same issue here. Any updates? |
So how do we deal with this issue at the moment? Thanks FWIW DynamoDB.Types also doesn't seem to be exported, at least in 2.7.5 |
@midknight41 and others. |
Ok, that's right -
seems to work for me as well. At the same time,
So the workaround for now if we want to pass this object around, is to pass it as 'any' type. Thanks |
@chrisradek In regards to the I'm tidying thing up at present. I'll feedback once I've done that. |
@chrisradek the With regard to the fixing the first issue: What is the expectation in terms of the namespaces? For the const client: AWS.DynamoDB.DocumentClient; or const client: AWS.DynamoDB.Types.DocumentClient; and for the Types exposed for const params: AWS.DynamoDB.DocumentClient.Types.GetItemInput; or const params: AWS.DynamoDB.DocumentClient.GetItemInput; or something else? I think they can't be in the same namespace as the mainDynamoDB.Types namespace as I believe there are some naming collisions. I have to admit, I find the Types namespace a bit counter-intuitive but there you go. If I'm to help with this I'll need to understand which files are generated and which ones are maintained by hand. Could you enlighten me? |
@midknight41 I still need to export the typings for params/output for each operation these classes use. The only way to do this that I can see is to export them in the generated files as well, like the other interfaces that these classes expose: https://github.com/aws/aws-sdk-js/pull/1240/files#diff-78251b595701d9bf6bbe21acda93b196R146 I don't like having to declare a namespace alongside a class (i.e. |
@chrisradek I'll have a look over this on the way home and see if I can suggest anything better. |
Hey @chrisradek, In terms of minimising the amount of code, combining the type definitions for With both namespaces in the same file you avoid mapping every type from the DCInterfaces.d.ts file to the namespace declared in the main I've hacked a version of that together locally which I can put up somewhere if you'd like to see it. |
@midknight41 |
Here's the PoC as discussed: Here's the test file: I've not eliminated all the duplicates but it's easy to see where you can chop out lots of duplicate declarations. Might be a tidy solution with a generic to cut them down a bit more...not quite sure without looking at it more. Hope that helps. |
I can't wait for this to be ready! :-) |
@midknight41 |
I've updated the PR. Thanks @midknight41 for your help, I got some inspiration from your diff :) The latest changes in the PR exposes classes that live on service clients, and their interfaces. I made a change so that you can reference interfaces without the For example, you can do the following: import DynamoDB = require('../clients/dynamodb');
// define the 'DocumentClient' type
const client: DynamoDB.DocumentClient = new DynamoDB.DocumentClient();
// define the DocumentClient.GetItemInput type directly off the DocumentClient
const params: DynamoDB.DocumentClient.GetItemInput = {
TableName: 'MyTable',
Key: {
'my-key': 'value'
}
};
// reference service interfaces directly off the service namespace
const getParams: DynamoDB.GetItemInput = {
TableName: 'MyTable',
Key: {
'my-key': {
S: 'value'
}
}
}; I've started writing tests, but I need to write some more for |
Looks really good! |
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. |
The DocumentClient class isn't exposed via the TypeScript definitions. I believe the following should work but it does not.
I notice you do some code generation with typescript files so I thought I'd check in with you before doing a PR.
The text was updated successfully, but these errors were encountered: