Typescipt environment for development


Based on video course [FrontendMasters] Production-Grade TypeScript


https://github.com/mike-north/professional-ts


Configured project:
https://github.com/mike-north/professional-ts-my-lib


$ mkdir -p ~/projects/dev/ts/my-new-ts-project && cd ~/projects/dev/ts/my-new-ts-project
$ npm init -y


$ npm install --save-dev \
    @babel/preset-env \
    @babel/preset-typescript \
    @microsoft/api-documenter \
    @microsoft/api-extractor \
    @types/jest \
    @typescript-eslint/eslint-plugin \
    @typescript-eslint/parser \
    eslint \
    jest \
    typescript


$ vi package.json


package.json

***
"scripts": {
    "build": "tsc",
    "dev": "yarn build --watch --preserveWatchOutput",
    "lint": "eslint src --ext js,ts,jsx,tsx",
    "test": "jest"
  },
***


tsconfig.json


// You can generate default tsconfig.json
// $ ./node_modules/.bin/tsc --init


$ vi tsconfig.json
{
  "compilerOptions": {
    "target": "ES2018",
    "baseUrl": "./src",
    "strict": true,
    "rootDir": "src",
    "outDir": "dist",
    "composite": true,
    "module": "commonjs",
    "noUnusedLocals": true,
    "noUnusedParameters": true ,
    "noImplicitReturns": true,
    "stripInternal": true,
    "types": [],
    "forceConsistentCasingInFileNames": true
  },
  "include": ["src"]
}


Compiler Options
https://www.typescriptlang.org/docs/handbook/compiler-options.html

ts-node useful for Node.js projects

$ npm install --save-dev ts-node


$ vi package.json


package.json

***
    "ts-node": "ts-node ./src/index.ts",
***


$ npm run ts-node


Eslint Jest for TypeScript


Webpack & TypeScript Setup

https://www.youtube.com/watch?v=sOUhEJeJ-kI