IssueRaiser

support TypeScript for backend functions

**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.

Posted by troygoode on Jan 4, 2019, 6:29 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments

ux (SaaS)

support TypeScript for backend functions

troygoodeJan 4, 2019, 6:29 AM

**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.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue