I’m a big fan of TypeScript and I think event-driven serverless apps in particular are an ideal candidate for type definitions. Being able to define and enforce a schema for an event which is published in one place and consumed (sync or async) in multiple other locations is a great benefit, making it much easier to refactor event flows without risking breaking something. Yes, infrastructure deployment frameworks such as the AWS CDK already use TypeScript, and while that’s nice, I’m more bullish about using TypeScript for runtime application code.
Sam (who is fast becoming the Serverless TypeScript Guy btw) also recently released another AWS TypeScript library, typesafe-dynamodb . It’s a type-only library that hooks into the AWS DynamoDB SDK and allows for strongly typed parameter and return payloads for the core DynamoDB operations based on the structure of your DynamoDB table items (which you specify as a TypeScript interface). I particularly like the Single Table Design feature which enforces specific prefixes on composite fields such as
sk. The library currently supports the
DynamoDBClient (as of 2022-03-01) but has an open issue to add support for
I’ve started maintaining a list of Typescript tools for serverless apps in my notes vault. If you have any suggestions, please let me know and I’ll add it in. And if you like these tools and have further suggestions, please let Sam know.
Indie Cloud Consultant helping small teams learn and build with serverless.
Learn more how I can help you here.
Join daily email list
I publish short emails like this on building software with serverless on a daily-ish basis. They’re casual, easy to digest, and sometimes thought-provoking. If daily is too much, you can also join my less frequent newsletter to get updates on new longer-form articles.