aws-amplify / aws-amplify/amplify-cli

support TypeScript for backend functions

Open
#659 41 comments 152 reactions 0 assignees View on GitHub
feature-request functions p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

**Is your feature request related to a problem? Please describe.**

I use the TypeScript generation features for my front-end client, but am frustrated that any of the Lambda functions I create via `amplify add api` or `amplify add function` must be written in vanilla JavaScript. This also makes it very difficult to share code between the backend and frontend (note that many of the auto-generated files created by `amplify cli` use syntax like `export default blah` that is invalid for use in the backend files).

**Describe the solution you'd like**

Switch to using `tsc` to compile the files found in `amplify/backend/function/*/src/` so that we can opt-in to type-safety by changing our file extension from `.js` to `.ts` or `.tsx`, similar to how Create React App has handled this in version 2.0.0+.

**Describe alternatives you've considered**

Alternatively, add (or document) how we can hook into the build process for `amplify/backend/function/*` so we can inject a TypeScript transpilation step ourselves.

Contributor guide

Open the contributing guide

Research direction

Start with the amplify add api and amplify add function entry points and the files under amplify/backend/function/*/src/. Trace the current function build process, then verify how an opted-in .ts or .tsx function would be compiled with tsc and remain usable through the existing backend workflow; the issue does not name specific tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, typescript
Domain
backend, cli, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.