Last active
August 22, 2022 04:12
-
-
Save raydot/0853a8e968efeac6187f5e503f604527 to your computer and use it in GitHub Desktop.
Basic typescript.config file, with explanations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
// project options | |
"lib": [ | |
"ESNext", | |
"dom" | |
], // specifies which default set of type definitions to use ("DOM", "ES6", etc.) | |
"outDir": "lib", // .js (as well as .d.ts, .js.map, etc.) The directory where your files will be created | |
"removeComments": true, // Strips all comments from TypeScript files when converting to JavaScript | |
"target": "ES6", // Target environment | |
// Module resolution | |
"baseUrl": "./", // Lets you set a base directory to resolve non-absolute module names | |
"esModuleInterop": true, // fixes some issues TS originally had with the ES6 spec where TypeScript treats CommonJS/AMD/UMD modules similar to ES6 modules | |
"moduleResolution": "node", // Pretty much always Node for modern JS. Other option is "classic" | |
"paths": {}, // A series of entries which re-map imports to lookup locations relative to the baseUrl | |
// Source Map | |
"sourceMap": true, // enables the use of source maps for debuggers and error reporting, etc. | |
"sourceRoot": "/", // Specify the location where a debugger should locate TypeScript files instead of relative source locations | |
// Strict Checks | |
"alwaysStrict": true, // Ensures that your files are parsed in the ECMAScript strict mode, and adds “use strict” to each source file | |
"allowUnreachableCode": false, // pick up dead code paths | |
"noImplicitAny": true, // TypeScript will fall back to a type of any for a variable when it cannot infer the type | |
"strictNullChecks": true, // When strictNullChecks is true, null and undefined have their own distinct types and you’ll get a type error if you try to use them where a concrete value is expected | |
// Linter Checks | |
"noImplicitReturns": true, | |
"noUncheckedIndexedAccess": true, // accessing index must always check for undefined | |
"noUnusedLocals": true, // Report errors on unused local variables | |
"noUnusedParameters": true // Report errors on unused parameters in functions | |
}, | |
"include": ["./**/*.ts"], | |
"exclude": [ | |
"node_modules/**/*" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment