Migrating to TypeScript from ES2015 for AWS Lambda
I had the skill up and running locally (bridged via an Express.js node front end for testing) and everything was working well. Then it came the time to upload my skill to the amazon developer portal and migrate my function to AWS Lambda. This is where the fun started – it turns out Lambda uses a fairly dated version of Node.js that doesn’t support much of the ES2015 specification.
- Rename all my .js files to .ts
- Install tsc from the command line (npm install –g tsc) and create my tsconfig.json with the list of files in my project
- Run typescript in watch mode (tsc –w) to get it to watch for changes to save (my lazy hands) having to recompile manually
Migration was such a smooth and painless experience and I’m now in a much better place than I was prior to the conversion. I have compile time type checking, I get to use the much more elegant and succinct ES2015 syntax and I have a much better development environment through the “knowledge” TypeScript now has about my code.