├── src ├── enums │ ├── example.enum.ts │ └── index.ts ├── constants │ ├── example.constant.ts │ └── index.ts ├── interfaces │ ├── example.interface.ts │ └── index.ts ├── services │ ├── index.ts │ └── user.service.ts ├── controllers │ ├── index.ts │ └── user.controller.ts ├── models │ ├── relations │ │ ├── index.ts │ │ └── user.relation.ts │ ├── sequelize.ts │ ├── index.ts │ └── user.model.ts ├── middlewares │ ├── index.ts │ └── example.middleware.ts ├── routers │ ├── index.ts │ └── user.router.ts ├── app.ts └── index.ts ├── jest.config.js ├── tests ├── index.test.ts └── services │ └── user.service.test.ts ├── environment └── .env.example ├── .eslintrc.js ├── LICENSE ├── .gitignore ├── package.json ├── README.md └── tsconfig.json /src/enums/example.enum.ts: -------------------------------------------------------------------------------- 1 | export enum EExample { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/constants/example.constant.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | TITLE: 'example-title', 3 | } -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node', 4 | }; -------------------------------------------------------------------------------- /src/interfaces/example.interface.ts: -------------------------------------------------------------------------------- 1 | export interface Example { 2 | name: string; 3 | } 4 | -------------------------------------------------------------------------------- /src/services/index.ts: -------------------------------------------------------------------------------- 1 | import { UserService } from './user.service'; 2 | 3 | export { 4 | UserService, 5 | } -------------------------------------------------------------------------------- /src/controllers/index.ts: -------------------------------------------------------------------------------- 1 | import { UserController } from './user.controller'; 2 | 3 | export { 4 | UserController, 5 | } 6 | -------------------------------------------------------------------------------- /src/enums/index.ts: -------------------------------------------------------------------------------- 1 | import * as ExampleENums from './example.enum'; 2 | 3 | export default { 4 | ExampleENums, 5 | } 6 | -------------------------------------------------------------------------------- /src/constants/index.ts: -------------------------------------------------------------------------------- 1 | import exampleConstants from './example.constant'; 2 | 3 | export default { 4 | exampleConstants, 5 | } -------------------------------------------------------------------------------- /src/models/relations/index.ts: -------------------------------------------------------------------------------- 1 | import UserRelations from './user.relation' 2 | 3 | export default { 4 | UserRelations 5 | } 6 | -------------------------------------------------------------------------------- /src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | import * as ExampleInterfaces from './example.interface'; 2 | 3 | export default { 4 | ExampleInterfaces, 5 | } -------------------------------------------------------------------------------- /src/middlewares/index.ts: -------------------------------------------------------------------------------- 1 | import * as ExampleMiddleware from './example.middleware'; 2 | 3 | export { 4 | ExampleMiddleware, 5 | }; 6 | -------------------------------------------------------------------------------- /src/models/relations/user.relation.ts: -------------------------------------------------------------------------------- 1 | // import { User } from '..'; 2 | 3 | export default (): void => { 4 | // Create relations for user here. 5 | } 6 | -------------------------------------------------------------------------------- /tests/index.test.ts: -------------------------------------------------------------------------------- 1 | describe("Test Jest package", () => { 2 | it("Testing should pass", () => { 3 | expect(true).toEqual(true); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /src/models/sequelize.ts: -------------------------------------------------------------------------------- 1 | import { Sequelize } from 'sequelize' 2 | 3 | const { 4 | DATABASE_URL = '', 5 | } = process.env 6 | 7 | const sequelize = new Sequelize(DATABASE_URL); 8 | 9 | export default sequelize 10 | -------------------------------------------------------------------------------- /environment/.env.example: -------------------------------------------------------------------------------- 1 | # DATABASE URL: 2 | DATABASE_URL=[DATABASE_SYSTEM]://[DB_USERNAME]:[DB_USER_PASSWORD]@[DB_SERVER_HOST]:[DB_SERVER_PORT]/[DB_NAME] 3 | 4 | #HOST DATA: 5 | HOST=[EXPRESS_SERVER_HOST] 6 | PORT=[EXPRESS_SERVER_PORT] 7 | -------------------------------------------------------------------------------- /src/services/user.service.ts: -------------------------------------------------------------------------------- 1 | import { User } from "../models"; 2 | import { WhereAttributeHash } from "sequelize/types"; 3 | 4 | export class UserService { 5 | index = (where?: WhereAttributeHash): Promise => { 6 | return User.findAll({ where }); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/models/index.ts: -------------------------------------------------------------------------------- 1 | import sequelize from './sequelize' 2 | import User from './user.model' 3 | 4 | import relations from './relations' 5 | 6 | Object.values(relations).forEach((relationsFunction: Function) => { 7 | relationsFunction() 8 | }) 9 | 10 | export { 11 | sequelize, 12 | User, 13 | } 14 | -------------------------------------------------------------------------------- /src/middlewares/example.middleware.ts: -------------------------------------------------------------------------------- 1 | import { NextFunction } from "express"; 2 | 3 | export const exampleMiddlewareFn = (request: Request, response: Response, next: NextFunction): void => { 4 | // Do some checks and return error if the check fails, 5 | // Or call next function to pass this middleware. 6 | next(); 7 | } 8 | -------------------------------------------------------------------------------- /src/routers/index.ts: -------------------------------------------------------------------------------- 1 | import router, { Request, Response, NextFunction } from 'express'; 2 | 3 | import UserRouter from './user.router'; 4 | 5 | const apiRouter = router(); 6 | 7 | apiRouter.use('/users', UserRouter); 8 | 9 | apiRouter.all('*', (request: Request, response: Response, errorHandler: NextFunction) => { 10 | errorHandler(new Error('Page not found')); 11 | }); 12 | 13 | export default apiRouter; -------------------------------------------------------------------------------- /tests/services/user.service.test.ts: -------------------------------------------------------------------------------- 1 | import dotenvFlow from 'dotenv-flow'; 2 | dotenvFlow.config({ path: './environment' }); 3 | 4 | import { UserService } from "../../src/services"; 5 | const userService = new UserService(); 6 | 7 | describe("Test Jest package", () => { 8 | it("Testing should pass", async () => { 9 | await expect(userService.index()).resolves.toBeTruthy(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /src/routers/user.router.ts: -------------------------------------------------------------------------------- 1 | import { Router } from 'express'; 2 | import { UserController } from '../controllers'; 3 | 4 | const router = Router(); 5 | 6 | const userController = new UserController(); 7 | 8 | router.get('/', userController.index); 9 | // router.put('/:id', ExampleController.update); 10 | // router.delete('/:id', ExampleController.del); 11 | // router.post('/', ExampleController.create); 12 | 13 | export default router; 14 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "es6": true, 4 | "node": true 5 | }, 6 | "extends": [ 7 | "eslint:recommended", 8 | "plugin:@typescript-eslint/eslint-recommended", 9 | "plugin:@typescript-eslint/recommended", 10 | "plugin:@typescript-eslint/recommended-requiring-type-checking" 11 | ], 12 | "globals": { 13 | "Atomics": "readonly", 14 | "SharedArrayBuffer": "readonly" 15 | }, 16 | "parser": "@typescript-eslint/parser", 17 | "parserOptions": { 18 | "tsconfigRootDir": __dirname, 19 | "project": ["./tsconfig.json"], 20 | "ecmaVersion": 2018, 21 | "sourceType": "module" 22 | }, 23 | "plugins": [ 24 | "@typescript-eslint" 25 | ], 26 | "rules": { 27 | } 28 | }; -------------------------------------------------------------------------------- /src/app.ts: -------------------------------------------------------------------------------- 1 | import express, { Request, Response, NextFunction } from 'express' 2 | import apiRouter from './routers'; 3 | 4 | 5 | export class ExpressApp { 6 | 7 | app = express(); 8 | 9 | constructor() { 10 | this.setAppSettings(); 11 | this.setAppRouter(); 12 | } 13 | 14 | setAppSettings = (): void => { 15 | this.app.use(express.json()) 16 | this.app.use(express.urlencoded({ extended: true })) 17 | } 18 | 19 | setAppRouter = (): void => { 20 | // eslint-disable-next-line @typescript-eslint/no-unused-vars 21 | this.app.use('/api', apiRouter, (error: Error, request: Request, response: Response, next: NextFunction) => { 22 | response.status(400).json({ 23 | success: false, 24 | error: error.message, 25 | }); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/controllers/user.controller.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response, NextFunction } from 'express'; 2 | import { UserService } from '../services'; 3 | import Boom from '@hapi/boom'; 4 | 5 | export class UserController { 6 | 7 | private userService = new UserService(); 8 | 9 | index = (request: Request, response: Response, errorHandler: NextFunction): void => { 10 | // Get request query 11 | // const query = request.query; 12 | 13 | // Get request query 14 | // const body = request.body; 15 | 16 | // Get request params 17 | // const params = request.params; 18 | 19 | this.userService.index().then((users) => { 20 | // To send response 21 | response.status(200).json({ 22 | success: true, 23 | body: { 24 | users, 25 | }, 26 | }); 27 | }).catch((error: Error) => { 28 | errorHandler(Boom.badRequest(error.message)); 29 | }); 30 | } 31 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Muhammad Shareef 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import DotenvFlow from 'dotenv-flow'; 2 | DotenvFlow.config({ path: './environment' }); 3 | import { ExpressApp } from './app'; 4 | import Http from 'http'; 5 | import { sequelize } from './models'; 6 | import { Sequelize } from 'sequelize/types'; 7 | 8 | export class Server { 9 | 10 | expressApp = new ExpressApp(); 11 | httpServer: Http.Server; 12 | 13 | constructor(){ 14 | this.httpServer = new Http.Server(this.expressApp.app); 15 | } 16 | 17 | runServer = (): Promise => { 18 | return this.databaseConnection() 19 | .then(this.serverListen) 20 | .catch(this.serverErrorHandler); 21 | } 22 | 23 | databaseConnection = (): Promise => { 24 | return this.sequelizeAuthenticate() 25 | .then(this.sequelizeSync); 26 | } 27 | 28 | sequelizeAuthenticate = (): Promise => { 29 | return sequelize.authenticate(); 30 | } 31 | 32 | sequelizeSync = (): Promise => { 33 | return sequelize.sync({ force: false }); 34 | } 35 | 36 | serverListen = (): Http.Server => { 37 | const { PORT: port, HOST: host } = process.env 38 | return this.httpServer.listen(port, (): void => { 39 | console.log(`Server is running on: http://${host}:${port}`) 40 | }); 41 | } 42 | 43 | serverErrorHandler = (error: Error): void => { 44 | console.log('Server run error: ', error.message); 45 | } 46 | 47 | } 48 | 49 | const server = new Server(); 50 | server.runServer(); 51 | -------------------------------------------------------------------------------- /src/models/user.model.ts: -------------------------------------------------------------------------------- 1 | import sequelize from './sequelize' 2 | import { Model, DataTypes } from 'sequelize' 3 | 4 | class User extends Model { 5 | public id!: number; 6 | public firstName!: string; 7 | public lastName!: string; 8 | public birthdate!: Date; 9 | public phone!: string; 10 | 11 | public readonly updatedAt!: Date; 12 | public readonly createdAt!: Date; 13 | } 14 | 15 | User.init({ 16 | id: { 17 | type: DataTypes.INTEGER, 18 | autoIncrement: true, 19 | primaryKey: true 20 | }, 21 | firstName: { 22 | type: DataTypes.STRING(64), 23 | allowNull: false, 24 | validate: { 25 | len: { 26 | args: [2, 64], 27 | msg: 'First name length must be between 2 and 64 characters' 28 | } 29 | } 30 | }, 31 | lastName: { 32 | type: DataTypes.STRING(64), 33 | allowNull: false, 34 | validate: { 35 | len: { 36 | args: [2, 64], 37 | msg: 'Last name length must be between 2 and 64 characters' 38 | } 39 | } 40 | }, 41 | birthdate: { 42 | type: DataTypes.DATE, 43 | allowNull: false, 44 | validate: { 45 | isDate: { 46 | args: true, 47 | msg: 'Birthdate must be in a valid date format' 48 | } 49 | } 50 | }, 51 | phone: { 52 | type: DataTypes.STRING(14), 53 | allowNull: false, 54 | unique: true, 55 | validate: { 56 | is: { 57 | args: /^\+?[0-9]*$/g, 58 | msg: 'Phone number must use + at first (optional) and numbers only' 59 | }, 60 | len: { 61 | args: [7, 14], 62 | msg: 'Phone number length must be between 7 and 14' 63 | } 64 | } 65 | } 66 | }, { sequelize }) 67 | 68 | export default User 69 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | environment/.env.local 75 | environment/.env.development 76 | environment/.env.production 77 | 78 | # parcel-bundler cache (https://parceljs.org/) 79 | .cache 80 | 81 | # Next.js build output 82 | .next 83 | 84 | # Nuxt.js build / generate output 85 | .nuxt 86 | dist 87 | 88 | # Gatsby files 89 | .cache/ 90 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 91 | # https://nextjs.org/blog/next-9-1#public-directory-support 92 | # public 93 | 94 | # vuepress build output 95 | .vuepress/dist 96 | 97 | # Serverless directories 98 | .serverless/ 99 | 100 | # FuseBox cache 101 | .fusebox/ 102 | 103 | # DynamoDB Local files 104 | .dynamodb/ 105 | 106 | # TernJS port file 107 | .tern-port 108 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript-express-sequelize-template", 3 | "version": "1.0.0", 4 | "description": "Backend template made using NodeJS, ExpressJS, Sequelize technologies", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "SET NODE_ENV=test&& jest", 8 | "test:coverage": "SET NODE_ENV=test&& jest --coverage", 9 | "tsc": "tsc", 10 | "start": "tsc && node ./dist/index.js", 11 | "serve:local": "SET NODE_ENV=local && ts-node-dev --respawn --transpileOnly ./src/index.ts", 12 | "serve:development": "SET NODE_ENV=development && ts-node-dev --respawn --transpileOnly --env=development ./src/index.ts", 13 | "serve:production": "SET NODE_ENV=production && ts-node-dev --respawn --transpileOnly --env=production ./src/index.ts", 14 | "eslint": "eslint ./src/**/* ./tests/**/*", 15 | "eslint:fix": "eslint ./src/**/* ./tests/**/* --fix" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/mhmdtshref/typescript-express-sequelize-template.git" 20 | }, 21 | "husky": { 22 | "hooks": { 23 | "pre-commit": "npm run eslint:fix" 24 | } 25 | }, 26 | "keywords": [ 27 | "template", 28 | "github", 29 | "repo", 30 | "repository", 31 | "backend", 32 | "Express", 33 | "ExpressJS", 34 | "Node", 35 | "NodeJS", 36 | "Sequelize" 37 | ], 38 | "author": "Mohamed Sharif", 39 | "license": "MIT", 40 | "bugs": { 41 | "url": "https://github.com/mhmdtshref/typescript-express-sequelize-template/issues" 42 | }, 43 | "homepage": "https://github.com/mhmdtshref/typescript-express-sequelize-template#readme", 44 | "dependencies": { 45 | "@hapi/boom": "^9.1.0", 46 | "@types/jest": "^25.2.2", 47 | "bluebird": "^3.7.2", 48 | "dotenv-flow": "^3.1.0", 49 | "express": "^4.17.1", 50 | "pg": "^8.0.2", 51 | "sequelize": "^5.21.6", 52 | "validator": "^13.0.0" 53 | }, 54 | "devDependencies": { 55 | "@types/bluebird": "^3.5.30", 56 | "@types/dotenv-flow": "^3.0.0", 57 | "@types/express": "^4.17.6", 58 | "@types/lodash": "^4.14.149", 59 | "@types/validator": "^13.0.0", 60 | "@typescript-eslint/eslint-plugin": "^2.28.0", 61 | "@typescript-eslint/parser": "^2.28.0", 62 | "eslint": "^6.8.0", 63 | "eslint-config-google": "^0.14.0", 64 | "eslint-config-standard": "^14.1.1", 65 | "eslint-plugin-import": "^2.20.2", 66 | "eslint-plugin-node": "^11.1.0", 67 | "eslint-plugin-promise": "^4.2.1", 68 | "eslint-plugin-standard": "^4.0.1", 69 | "husky": "^4.2.5", 70 | "jest": "^26.0.1", 71 | "ts-jest": "^25.5.1", 72 | "ts-node-dev": "^1.0.0-pre.44", 73 | "typescript": "^3.8.3" 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Typescript Express Sequelize Template 2 | 3 | You don't need to start your backend project from scratch anymore! This is a usefull, structured and supported with helpful examples, A backend template made mainly with four technologies: Express, Sequelize, Jest and Node server. 4 | ## Prerequisites 5 | To be able to use this template, you need these technologies to be installed on your machine: 6 | - NodeJS 7 | - NPM 8 | Also, you need to have any SQL database URL (this project has been tested with PostgreSQL-v12 database). 9 | ## Built with 10 | This project has been created using these technologies: 11 | - NodeJS 12 | - Express 13 | - Typescript 14 | - Sequelize 15 | - Hapi/Boom 16 | - Jest 17 | - ESLint 18 | - Husky 19 | ## Installation 20 | Follow these steps respectively: 21 | ### 1. Clone the template 22 | At first, you need to clone this template on your local machine, it would be better for you to **fork** this repo to your account. Specially if you want to make changes on the template and use your version later (then clone your forked repo), otherwise, clone my repo by running this command on your terminal: 23 | ``` 24 | git clone https://github.com/mhmdtshref/typescript-express-sequelize-template.git 25 | ``` 26 | ### 2. Add environments files 27 | You need to add environment variables to be able to connect to server port, host and database server. There's an example of env file in `environment/.env.example`. You should create a new file for each development mode, for example, for local mode, create a file with the name `.env.local`, then copy the example file content, and replace the variables values with yours. 28 | ### 3. Install NPM packages 29 | Now, you need to install packages of package.json and package-lock.json files, just run this command on the root directory: `environments/.env.example` 30 | ### 4. Run the app (initial app): 31 | #### **Warning: By running this the up comming command, you'll create the user example table to the database.** 32 | Just run the npm script command: 33 | ``` 34 | npm run serve:[ENVIRONMENT_NAME] 35 | ``` 36 | The template is supporting four environments, you can modify them from pakcage.json > scripts 37 | npm install.For example, run the template `npm run serve:local`, to run the app using local environment mode. 38 | ## Features 39 | - Full API call example (so you can track it and know how API call life cycle work). 40 | - Using Typescript language. 41 | - Setup testing evironment using Jest tests with coverage reporting. 42 | - Separated files for relations/associations between sequelize models. 43 | - Database models validations. 44 | - Using MVC pattern. 45 | - eslint linting and fixing scripts. 46 | - Auto-fixing for linting errors before committing changes. 47 | - Supporting Multiple environments. 48 | - One place to handle errors. 49 | - Error handling using Hapi/Boom module (consistant & structured errors). 50 | 51 | ## Developers: 52 | |
Mohamed Sharif| 53 | |---------------------------------------------------------------------------------------------------------------------| 54 | | | 55 | 56 | ## License 57 | This project is licensed under the MIT License - see the [LICENSE](https://github.com/mhmdtshref/typescript-express-sequelize-template/blob/master/LICENSE) file for details 58 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Basic Options */ 4 | // "incremental": true, /* Enable incremental compilation */ 5 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ 6 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ 7 | // "lib": [], /* Specify library files to be included in the compilation. */ 8 | // "allowJs": true, /* Allow javascript files to be compiled. */ 9 | // "checkJs": true, /* Report errors in .js files. */ 10 | // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ 11 | // "declaration": true, /* Generates corresponding '.d.ts' file. */ 12 | // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ 13 | // "sourceMap": true, /* Generates corresponding '.map' file. */ 14 | // "outFile": "./", /* Concatenate and emit output to single file. */ 15 | "outDir": "./dist", /* Redirect output structure to the directory. */ 16 | // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 17 | // "composite": true, /* Enable project compilation */ 18 | // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ 19 | // "removeComments": true, /* Do not emit comments to output. */ 20 | // "noEmit": true, /* Do not emit outputs. */ 21 | // "importHelpers": true, /* Import emit helpers from 'tslib'. */ 22 | // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ 23 | // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ 24 | 25 | /* Strict Type-Checking Options */ 26 | "strict": true, /* Enable all strict type-checking options. */ 27 | // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ 28 | // "strictNullChecks": true, /* Enable strict null checks. */ 29 | // "strictFunctionTypes": true, /* Enable strict checking of function types. */ 30 | // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ 31 | // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ 32 | // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ 33 | // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ 34 | 35 | /* Additional Checks */ 36 | // "noUnusedLocals": true, /* Report errors on unused locals. */ 37 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 38 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 39 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 40 | 41 | /* Module Resolution Options */ 42 | // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ 43 | // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ 44 | // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ 45 | // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ 46 | // "typeRoots": [], /* List of folders to include type definitions from. */ 47 | // "types": [], /* Type declaration files to be included in compilation. */ 48 | // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ 49 | "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 50 | // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ 51 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 52 | 53 | /* Source Map Options */ 54 | // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ 55 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 56 | // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ 57 | // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ 58 | 59 | /* Experimental Options */ 60 | // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ 61 | // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ 62 | 63 | /* Advanced Options */ 64 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ 65 | } 66 | } 67 | --------------------------------------------------------------------------------