Typescript version of the app api


#1

I made a Typescript version here. Feedback and suggestions are welcome.


#2

@vha14 Oh that is awesome. Would you be interested in writing up the steps you took to set it up? I’d like to add an Extra Credit chapter for this.


#3
  • Update package.json:
    • Remove all babel related devDependencies and add typescript dependencies (@types/aws-lambda, @types/node, and @types/uuid, ts-loader, and typescript).
    • Remove babel-runtime and source-map-support from dependencies.
  • Add tsconfig.json.
  • In webpack.config.js, update the devtool line to enable source map support.
  • In webpack.config.js, update the extension resolver to process .ts files.
  • In webpack.config.js, update the test and the loader rules.
  • Change all .js source code files to .ts extension.

You can now start using TypeScript features (see example).


#4

I also noted that the TypeScript lambda packages are about 56KB whereas the JavaScript with babel-runtime and source-map-support are 1.4MB.


#5

Thanks for this. I’m going to draft up a chapter on this soon. I’ll post it once I get a chance.

Or if you are interested in contributing it yourself, here are some instructions - https://github.com/AnomalyInnovations/serverless-stack-com/blob/master/CONTRIBUTING.md#add-an-extra-credit-chapter. Let me know and I can help you get started.