Skip to content

Commit

Permalink
add example for typescript docs
Browse files Browse the repository at this point in the history
  • Loading branch information
swyxio authored Dec 3, 2018
1 parent d3edd6d commit af0f995
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ The default webpack configuration uses `babel-loader` with a [few basic settings

However, if any `.babelrc` is found in the directory `netlify-lambda` is run from, it will be used instead of the default one. If you need to run different babel versions for your lambda and for your app, [check this issue](https://github.com/netlify/netlify-lambda/issues/34) to override your webpack babel-loader.

### How to use TypeScript
### Use with TypeScript

We added `.ts` and `.mjs` support recently - [check here for the PR and usage tips](https://github.com/netlify/netlify-lambda/pull/76).

Expand All @@ -149,7 +149,9 @@ We added `.ts` and `.mjs` support recently - [check here for the PR and usage ti
npm install --save-dev @babel/preset-typescript
```

2. Create custom `.babelrc`.
You may also want to add `typescript @types/node @types/aws-lambda`.

2. Create a custom `.babelrc` file:

```diff
{
Expand All @@ -172,6 +174,8 @@ npm install --save-dev @babel/preset-typescript
}
```

3. (Optional) if you have `@types/aws-lambda` installed, your lambda functions can use the community typings for `Handler, Context, Callback`. See the typescript instructions in [create-react-app-lambda](https://github.com/netlify/create-react-app-lambda/blob/master/README.md#typescript) for an example.

### --static option

If you need an escape hatch and are building your lambda in some way that is incompatible with our build process, you can skip the build with the `-s` or `--static` flag. [More info here](https://github.com/netlify/netlify-lambda/pull/62).
Expand Down

0 comments on commit af0f995

Please sign in to comment.