├── .eslintrc.json ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── README.md ├── commitlint.config.js ├── compose.yaml ├── jest-mongodb-config.js ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── infrastructure │ └── db │ │ └── mongodb │ │ └── helpers │ │ └── db-connection.ts └── main │ ├── config │ ├── app.ts │ ├── env.ts │ └── routes.ts │ └── server.ts ├── test └── db │ └── mongodb │ └── helpers │ └── db-connecion.spec.ts ├── tsconfig-build.json └── tsconfig.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es2021": true, 4 | "node": true 5 | }, 6 | "extends": "standard-with-typescript", 7 | "overrides": [ 8 | ], 9 | "parserOptions": { 10 | "ecmaVersion": "latest", 11 | "sourceType": "module", 12 | "project": "./tsconfig.json" 13 | }, 14 | "rules": { 15 | "@typescript-eslint/strict-boolean-expressions": "off" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | /node_modules 4 | /dist 5 | /coverage 6 | globalConfig.json 7 | /data 8 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Catalog API - [Clean Architecture with Typescript Series](https://www.youtube.com/watch?v=bRl-sTvLbsI&list=PLN3ZW2QI7gLfQ4oEkDWw0DZVIjvAjO140&index=2) 2 | 3 | Geo-targeted API to find the latest catalogs (flyers) and the best deals from the nearest retailers, helping customers to save on their purchases. 4 | 5 | The API is built with TypeScript and MongoDB on top of Node.js, using TDD, Clean Architecture, SOLID principles, and some Design Patterns and DDD Patterns. 6 | 7 | It serves geolocated content based on city and uses roles and permissions to manage all resources (such as catalogs, retailers, and categories). The API also supports several filters, such as a product filter within the catalogs, which is possible thanks to the use of an OCR (Google Vision API) to extract text from each page of the catalogs. 8 | 9 | > This repository is part of a series of videos about Clean Architecture with TypeScript. [You can follow the series on YouTube](https://www.youtube.com/watch?v=bRl-sTvLbsI&list=PLN3ZW2QI7gLfQ4oEkDWw0DZVIjvAjO140&index=2). 10 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | module.exports = {extends: ['@commitlint/config-conventional']} 4 | -------------------------------------------------------------------------------- /compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mongodb: 3 | container_name: catalog-mongodb 4 | image: mongo:6 5 | restart: always 6 | volumes: 7 | - ./data/db:/data/db 8 | ports: 9 | - 27017:27017 10 | api: 11 | container_name: catalog-api 12 | image: node:18 13 | working_dir: /usr/src/app 14 | restart: always # Policy applied to the container termination 15 | environment: # Environment variables 16 | - MONGO_URL=mongodb://mongodb:27017/catalog 17 | volumes: # Defines the volumes to be mounted in the container 18 | - ./package.json:/usr/src/app/package.json 19 | - ./package-lock.json:/usr/src/app/package-lock.json 20 | - ./dist:/usr/src/app/dist 21 | ports: # Exposes container ports to the host (HOST:CONTAINER) 22 | - 3000:3000 23 | command: bash -c "npm install && npm run dev" # Overrides the default cmd of the image 24 | links: # Links the container to another container using a network alias 25 | - mongodb 26 | depends_on: # Defines the dependencies of the container 27 | - mongodb -------------------------------------------------------------------------------- /jest-mongodb-config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | module.exports = { 4 | mongodbMemoryServerOptions: { 5 | binary: { 6 | version: '6.0.2', 7 | skipMD5: true, 8 | }, 9 | autoStart: false, 10 | instance: {}, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 3 | /* 4 | * For a detailed explanation regarding each configuration property, visit: 5 | * https://jestjs.io/docs/configuration 6 | */ 7 | 8 | const { defaults: tsjPreset } = require('ts-jest/presets') 9 | 10 | module.exports = { 11 | // All imported modules in your tests should be mocked automatically 12 | // automock: false, 13 | 14 | // Stop running tests after `n` failures 15 | // bail: 0, 16 | 17 | // The directory where Jest should store its cached dependency information 18 | // cacheDirectory: "/private/var/folders/g1/_7w969f94ps3zw0ctkrj3vlc0000gn/T/jest_dx", 19 | 20 | // Automatically clear mock calls, instances, contexts and results before every test 21 | // clearMocks: false, 22 | 23 | // Indicates whether the coverage information should be collected while executing the test 24 | // collectCoverage: false, 25 | 26 | // An array of glob patterns indicating a set of files for which coverage information should be collected 27 | collectCoverageFrom: [ 28 | "/src/**/*.ts", 29 | "!/src/main/**/*.ts", 30 | ], 31 | 32 | // The directory where Jest should output its coverage files 33 | coverageDirectory: "coverage", 34 | 35 | // An array of regexp pattern strings used to skip coverage collection 36 | // coveragePathIgnorePatterns: [ 37 | // "/node_modules/" 38 | // ], 39 | 40 | // Indicates which provider should be used to instrument code for coverage 41 | coverageProvider: "v8", 42 | 43 | // A list of reporter names that Jest uses when writing coverage reports 44 | // coverageReporters: [ 45 | // "json", 46 | // "text", 47 | // "lcov", 48 | // "clover" 49 | // ], 50 | 51 | // An object that configures minimum threshold enforcement for coverage results 52 | // coverageThreshold: undefined, 53 | 54 | // A path to a custom dependency extractor 55 | // dependencyExtractor: undefined, 56 | 57 | // Make calling deprecated APIs throw helpful error messages 58 | // errorOnDeprecated: false, 59 | 60 | // The default configuration for fake timers 61 | // fakeTimers: { 62 | // "enableGlobally": false 63 | // }, 64 | 65 | // Force coverage collection from ignored files using an array of glob patterns 66 | // forceCoverageMatch: [], 67 | 68 | // A path to a module which exports an async function that is triggered once before all test suites 69 | // globalSetup: undefined, 70 | 71 | // A path to a module which exports an async function that is triggered once after all test suites 72 | // globalTeardown: undefined, 73 | 74 | // A set of global variables that need to be available in all test environments 75 | // globals: {}, 76 | 77 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. 78 | // maxWorkers: "50%", 79 | 80 | // An array of directory names to be searched recursively up from the requiring module's location 81 | // moduleDirectories: [ 82 | // "node_modules" 83 | // ], 84 | 85 | // An array of file extensions your modules use 86 | // moduleFileExtensions: [ 87 | // "js", 88 | // "mjs", 89 | // "cjs", 90 | // "jsx", 91 | // "ts", 92 | // "tsx", 93 | // "json", 94 | // "node" 95 | // ], 96 | 97 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module 98 | moduleNameMapper: { 99 | "@domain/(.*)": "/src/domain/$1", 100 | "@application/(.*)": "/src/application/$1", 101 | "@infrastructure/(.*)": "/src/infrastructure/$1", 102 | "@main/(.*)": "/src/main/$1", 103 | "@test/(.*)": "/test/$1" 104 | }, 105 | 106 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader 107 | // modulePathIgnorePatterns: [], 108 | 109 | // Activates notifications for test results 110 | // notify: false, 111 | 112 | // An enum that specifies notification mode. Requires { notify: true } 113 | // notifyMode: "failure-change", 114 | 115 | // A preset that is used as a base for Jest's configuration 116 | preset: '@shelf/jest-mongodb', 117 | 118 | // Run tests from one or more projects 119 | // projects: undefined, 120 | 121 | // Use this configuration option to add custom reporters to Jest 122 | // reporters: undefined, 123 | 124 | // Automatically reset mock state before every test 125 | // resetMocks: false, 126 | 127 | // Reset the module registry before running each individual test 128 | // resetModules: false, 129 | 130 | // A path to a custom resolver 131 | // resolver: undefined, 132 | 133 | // Automatically restore mock state and implementation before every test 134 | // restoreMocks: false, 135 | 136 | // The root directory that Jest should scan for tests and modules within 137 | // rootDir: undefined, 138 | 139 | // A list of paths to directories that Jest should use to search for files in 140 | roots: [ 141 | "/test/" 142 | ], 143 | 144 | // Allows you to use a custom runner instead of Jest's default test runner 145 | // runner: "jest-runner", 146 | 147 | // The paths to modules that run some code to configure or set up the testing environment before each test 148 | // setupFiles: [], 149 | 150 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 151 | // setupFilesAfterEnv: [], 152 | 153 | // The number of seconds after which a test is considered as slow and reported as such in the results. 154 | // slowTestThreshold: 5, 155 | 156 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing 157 | // snapshotSerializers: [], 158 | 159 | // The test environment that will be used for testing 160 | // testEnvironment: "jest-environment-node", 161 | 162 | // Options that will be passed to the testEnvironment 163 | // testEnvironmentOptions: {}, 164 | 165 | // Adds a location field to test results 166 | // testLocationInResults: false, 167 | 168 | // The glob patterns Jest uses to detect test files 169 | // testMatch: [ 170 | // "**/__tests__/**/*.[jt]s?(x)", 171 | // "**/?(*.)+(spec|test).[tj]s?(x)" 172 | // ], 173 | 174 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped 175 | // testPathIgnorePatterns: [ 176 | // "/node_modules/" 177 | // ], 178 | 179 | // The regexp pattern or array of patterns that Jest uses to detect test files 180 | // testRegex: [], 181 | 182 | // This option allows the use of a custom results processor 183 | // testResultsProcessor: undefined, 184 | 185 | // This option allows use of a custom test runner 186 | // testRunner: "jest-circus/runner", 187 | 188 | // A map from regular expressions to paths to transformers 189 | transform: { 190 | ...tsjPreset.transform, 191 | }, 192 | 193 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 194 | // transformIgnorePatterns: [ 195 | // "/node_modules/", 196 | // "\\.pnp\\.[^\\/]+$" 197 | // ], 198 | 199 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them 200 | // unmockedModulePathPatterns: undefined, 201 | 202 | // Indicates whether each individual test should be reported during the run 203 | // verbose: undefined, 204 | 205 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode 206 | // watchPathIgnorePatterns: [], 207 | 208 | // Whether to use watchman for file crawling 209 | // watchman: true, 210 | }; 211 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "clean-architecture-with-typescript-api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "dist/main/server.js", 6 | "scripts": { 7 | "build": "rimraf dist && tsc -p tsconfig-build.json", 8 | "build:watch": "npm run build -- --watch", 9 | "start": "node dist/main/server.js", 10 | "dev": "nodemon -L --watch ./dist ./dist/main/server.js", 11 | "up": "concurrently --kill-others-on-fail \"npm run build:watch\" \"docker compose up\"", 12 | "down": "docker compose down", 13 | "test": "jest --passWithNoTests --runInBand --no-cache", 14 | "test:staged": "npm run test -- --findRelatedTests", 15 | "test:ci": "npm run test -- --coverage", 16 | "lint": "eslint --ignore-path .gitignore --ext .ts --fix", 17 | "prepare": "husky install" 18 | }, 19 | "repository": { 20 | "type": "git", 21 | "url": "git+https://github.com/dyarleniber/clean-architecture-with-typescript-api.git" 22 | }, 23 | "keywords": [], 24 | "author": "", 25 | "license": "ISC", 26 | "bugs": { 27 | "url": "https://github.com/dyarleniber/clean-architecture-with-typescript-api/issues" 28 | }, 29 | "homepage": "https://github.com/dyarleniber/clean-architecture-with-typescript-api#readme", 30 | "devDependencies": { 31 | "@commitlint/cli": "^17.1.2", 32 | "@commitlint/config-conventional": "^17.1.0", 33 | "@shelf/jest-mongodb": "^4.1.0", 34 | "@types/express": "^4.17.14", 35 | "@types/jest": "^29.0.1", 36 | "@types/node": "^18.7.16", 37 | "@types/supertest": "^2.0.12", 38 | "@typescript-eslint/eslint-plugin": "^5.36.2", 39 | "concurrently": "^7.4.0", 40 | "eslint": "8.22.0", 41 | "eslint-config-standard-with-typescript": "^22.0.0", 42 | "eslint-plugin-import": "^2.26.0", 43 | "eslint-plugin-n": "^15.2.5", 44 | "eslint-plugin-promise": "^6.0.1", 45 | "husky": "^8.0.0", 46 | "jest": "^29.0.3", 47 | "lint-staged": "^13.0.3", 48 | "nodemon": "^2.0.19", 49 | "rimraf": "^3.0.2", 50 | "supertest": "^6.2.4", 51 | "ts-jest": "^29.0.0", 52 | "typescript": "^4.8.3" 53 | }, 54 | "dependencies": { 55 | "express": "^4.18.2", 56 | "module-alias": "^2.2.2", 57 | "mongodb": "^4.9.1" 58 | }, 59 | "_moduleAliases": { 60 | "@domain": "dist/domain", 61 | "@application": "dist/application", 62 | "@infrastructure": "dist/infrastructure", 63 | "@main": "dist/main" 64 | }, 65 | "lint-staged": { 66 | "*.ts": [ 67 | "npm run lint", 68 | "npm run test:staged" 69 | ] 70 | }, 71 | "engines": { 72 | "node": "18.x" 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/infrastructure/db/mongodb/helpers/db-connection.ts: -------------------------------------------------------------------------------- 1 | import { Collection, MongoClient } from 'mongodb' 2 | 3 | class DbConnection { 4 | private url?: string 5 | 6 | private client?: MongoClient 7 | 8 | async connect (url: string): Promise { 9 | this.url = url 10 | this.client = new MongoClient(url) 11 | await this.client.connect() 12 | } 13 | 14 | async disconnect (): Promise { 15 | await this.client?.close() 16 | this.client = undefined 17 | } 18 | 19 | async getCollection (name: string): Promise { 20 | if (!this.client && this.url) { 21 | await this.connect(this.url) 22 | } 23 | const db = this.client?.db() 24 | if (!db) { 25 | throw new Error('MongoDB client is not connected') 26 | } 27 | return db.collection(name) 28 | } 29 | } 30 | 31 | export default new DbConnection() 32 | -------------------------------------------------------------------------------- /src/main/config/app.ts: -------------------------------------------------------------------------------- 1 | import express, { Express } from 'express' 2 | import setupRoutes from '@main/config/routes' 3 | 4 | export default (): Express => { 5 | const app = express() 6 | setupRoutes(app) 7 | return app 8 | } 9 | -------------------------------------------------------------------------------- /src/main/config/env.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | port: process.env.PORT ?? 3000, 3 | mongoUrl: process.env.MONGO_URL ?? 'mongodb://mongodb:27017/catalog' 4 | } 5 | -------------------------------------------------------------------------------- /src/main/config/routes.ts: -------------------------------------------------------------------------------- 1 | import { Express, Router } from 'express' 2 | 3 | export default (app: Express): void => { 4 | const router = Router() 5 | app.get('/health', (req, res) => { 6 | res.status(200).json({ message: 'ok' }) 7 | }) 8 | app.use(router) 9 | } 10 | -------------------------------------------------------------------------------- /src/main/server.ts: -------------------------------------------------------------------------------- 1 | import 'module-alias/register' 2 | import DbConnection from '@infrastructure/db/mongodb/helpers/db-connection' 3 | import setupApp from '@main/config/app' 4 | import env from '@main/config/env' 5 | 6 | DbConnection.connect(env.mongoUrl).then(() => { 7 | const app = setupApp() 8 | app.listen(env.port, () => console.log(`Server running on port ${env.port}`)) 9 | }).catch(console.error) 10 | -------------------------------------------------------------------------------- /test/db/mongodb/helpers/db-connecion.spec.ts: -------------------------------------------------------------------------------- 1 | import DbConnection from '@infrastructure/db/mongodb/helpers/db-connection' 2 | import env from '@main/config/env' 3 | 4 | describe('DbConnection', () => { 5 | beforeAll(async () => { 6 | await DbConnection.connect(env.mongoUrl) 7 | }) 8 | 9 | afterAll(async () => { 10 | await DbConnection.disconnect() 11 | }) 12 | 13 | it('should reconnect if mongodb is down', async () => { 14 | let collection = await DbConnection.getCollection('catalogs') 15 | expect(collection).toBeTruthy() 16 | await DbConnection.disconnect() 17 | collection = await DbConnection.getCollection('catalogs') 18 | expect(collection).toBeTruthy() 19 | }) 20 | }) 21 | -------------------------------------------------------------------------------- /tsconfig-build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["test"] 4 | } 5 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs", /* Specify what module code is generated. */ 29 | // "rootDir": "./", /* Specify the root folder within your source files. */ 30 | // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ 31 | "baseUrl": "./src", /* Specify the base directory to resolve non-relative module names. */ 32 | "paths": { 33 | "@domain/*": ["domain/*"], 34 | "@application/*": ["application/*"], 35 | "@infrastructure/*": ["infrastructure/*"], 36 | "@main/*": ["main/*"], 37 | "@test/*": ["../test/*"] 38 | }, /* Specify a set of entries that re-map imports to additional lookup locations. */ 39 | "rootDirs": [ 40 | "src", 41 | "test" 42 | ], /* Allow multiple folders to be treated as one when resolving modules. */ 43 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 44 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 45 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 46 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 47 | // "resolveJsonModule": true, /* Enable importing .json files. */ 48 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 49 | 50 | /* JavaScript Support */ 51 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 52 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 53 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 54 | 55 | /* Emit */ 56 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 57 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 58 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 59 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 60 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 61 | "outDir": "./dist", /* Specify an output folder for all emitted files. */ 62 | // "removeComments": true, /* Disable emitting comments. */ 63 | // "noEmit": true, /* Disable emitting files from a compilation. */ 64 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 65 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 66 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 67 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 68 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 69 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 70 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 71 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 72 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 73 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 74 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 75 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 76 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 77 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 78 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 79 | 80 | /* Interop Constraints */ 81 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 82 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 83 | "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ 84 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 85 | "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ 86 | 87 | /* Type Checking */ 88 | "strict": true, /* Enable all strict type-checking options. */ 89 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 90 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 91 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 92 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 93 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 94 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 95 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 96 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 97 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 98 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 99 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 100 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 101 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 102 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 103 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 104 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 105 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 106 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 107 | 108 | /* Completeness */ 109 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 110 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 111 | }, 112 | "include": ["src", "test"], 113 | "exclude": [] 114 | } 115 | --------------------------------------------------------------------------------