architect / functions

AWS Lambda Node runtime helpers for Architect apps
https://arc.codes
163 stars 38 forks source link

improve tables typings #526

Closed tbeseda closed 2 years ago

tbeseda commented 2 years ago

I used an intersection type to add top level methods and attributes to type ArcDB.

I also changed the return type for the put method to Record<string, any> since the Arc client returns the new/updated document. should it be Item?

editor screenshot ![image](https://user-images.githubusercontent.com/15697/174136639-fc6be6b7-fbd3-44da-9cac-b63c03bce51b.png)
tbeseda commented 2 years ago

@camjackson can you take a look at this? Let me know if there's a more TypeScript-y way to make this update.

camjackson commented 2 years ago

@tbeseda I left a couple of suggestions for more specific types. As for the intersection I think that's fine. I don't know of a better way to say "this object maps all the keys from Tables, and it also has these other properties".