Skip to content

Instantly share code, notes, and snippets.

@vschoener
Last active December 30, 2018 17:14
Show Gist options
  • Save vschoener/8392943773308c83c9efe34b5520b40d to your computer and use it in GitHub Desktop.
Save vschoener/8392943773308c83c9efe34b5520b40d to your computer and use it in GitHub Desktop.
Docker & TypeScript development
{
// This attribute will hold all the compile option of TypeScript
"compilerOptions": {
// Where are located your source code
"rootDir": "src",
// Where you want to put our compiled code
"outDir": "build",
// Which ES library you want to include
// If the project will be used as a server, no browser, then use the esnext or one of the last version)
// Otherwise, you I advice using ES6 but you still can use an advance ES version
// If you omit the option it will use
// For --target ES5: DOM,ES5,ScriptHost
// For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost
"lib": ["es2018", "dom"],
// Which ES version you want to target during compilation, this is reliable to the `lib` option
// This options is really important regarding the project usage too (back or front)
// Put ES5 if you need to IE compatibility, otherwise you can target at least es2017 or es2018
// Tip: Take a look at this here if you need to know which feature is available depending of your Node version
// @see https://node.green
"target": "es2018",
// Depends how you want to resolve your module, TypeScript tends to use the `classic` way but let's
// stick with the `node` one
// @see https://www.typescriptlang.org/docs/handbook/module-resolution.html
"moduleResolution": "node",
// From documentation, Specify module code generation
// commonjs === (target = ES3 OR ES5)
// Otherwise use es6
"module": "es6",
// Sourcemap is usefull for the debugging part
// During dev you should active this one and then disable it in production
"sourceMap": true,
// Reolve `.json`file without tricking with a custom and bad json.d.ts file
"resolveJsonModule": true,
// Allow to import node module without `import *`
// Ex import express from 'express'
"esModuleInterop": true
},
// The folder or files you want to exclude
// You can also use regex `**/*.spec.ts` for ex
"exclude":[
"node_modules",
"build"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment