Skip to content

Instantly share code, notes, and snippets.

@vdelacou
Last active May 5, 2020 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdelacou/eeb8931e510218dac1464d3cd592722c to your computer and use it in GitHub Desktop.
Save vdelacou/eeb8931e510218dac1464d3cd592722c to your computer and use it in GitHub Desktop.
How to add AWS Amplify function typescript
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"typescript.tsdk": "node_modules\\typescript\\lib",
"files.autoSave": "afterDelay",
"search.exclude": {
"**/node_modules": true,
"**/.vscode": true,
"**/build": true
},
"git.autofetch": true,
"javascript.format.enable": false,
"typescript.implementationsCodeLens.enabled": true,
"editor.trimAutoWhitespace": true,
"files.encoding": "utf8",
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"eslint.validate": ["typescript"],
"eslint.workingDirectories": [{ "pattern": "amplify/backend/function/*/ts" }],
"[typescript]": {
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
}
import { Callback, Context, Handler } from 'aws-lambda';
interface TriggerEvent {
key1: string;
key2: string;
key3: string;
}
export const handler: Handler<TriggerEvent, string> = (event: TriggerEvent, context: Context, callback: Callback<string>) => {
const concatKey = `${event.key1} ${event.key2} ${event.key3}`;
callback(null, concatKey);
};
{
"compilerOptions": {
"declaration": false,
"target": "ES2017",
"module": "commonjs",
"moduleResolution": "node",
"rootDir": ".",
"lib": ["es2017"],
"typeRoots": ["node_modules/@types"],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"sourceMap": false,
"strict": true,
"baseUrl": ".",
"outDir": "../src"
},
"include": ["./**/*"],
"exclude": ["node_modules"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment