Open MattNguyen opened 5 years ago
Hi Matt,
A TypeScript declaration file is on my list of TODOs. The typing will need to be a bit more complex than what you've got. The config
object stores a reference to the RDSDataService methods, but also promisifies them under the hood. I'll need to do a bit more research to figure this out. Any help would be greatly appreciated.
Thanks, Jeremy
@MattNguyen - I am going implement this lib in TS as well did you get anywhere with it by chance?
@jeremydaly - nice work on this; starting to pull it into a serverless(.com) based project that I have in TypeScript so checking to see if any work has been done in TS yet.
@MattNguyen I had to adjust your type definitions to fix settings (likely still incorrect) and make query
return a promise. See PR #49.
@cbschuld How is your implementation going?
@MarkHerhold my solution is here (https://github.com/cbschuld/rds-data). (https://www.npmjs.com/package/rds-data). Jeremy's library is so good just missing that Typescript ❤️ . I am not sold my adoption is great either, related specifically to how I am typing the return values, but it has been nice to have in a few of my TS projects.
@cbschuld Neat! Are you running it in prod? I could give it a try!
@MarkHerhold - yes, on a few different apps. So far so good!
Would be great to see this come through as this library seems to return data a nicer format than "rds-data" package mentioned above.
Hey @miketeix there is an open PR to change the way the data is returned from rds-data
. Interested in your feedback if you want to toss it over there.
Is there an update on this? Could be extremely useful having TypeScript, this seems like a very good library with good potential, because using aws-sdk is a pain with the Data API
@ffxsam, any interest in working on this?
@jeremydaly I don't have the bandwidth right now, unfortunately! I wish I did because I've been wanting TS support myself. 😄
@jeremydaly Because the PR hasn't been updated in a while I took some of the code there and modified it a bit, it's pretty basic but it does the job, I have created a PR at DefinitelyTyped - https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50495, If you could take a look there and offer improvements that would be great. Having no types for this is pretty annoying for me because I will need to use multiple instances of this library in lambda functions, so I would like it to have types without me needing to modify node_modules every time. Thank you!
By the way: I noticed that you are using legacy export syntax (module.exports
) which means that the TypeScript types cannot export stuff other than the default exported member, which is not ideal, also TypeScript would have to require this module like this import Client = require('data-api-client')
, if you could change to ES6 syntax exports I think that is the ideal solution.
@jeremydaly ping
It would be great to include a type declaration file.
I'm currently using this for now, but I'm seeing
TypeError: config.RDS.executeStatement is not a function
when executingquery()
.