TypeScript Settings

1. TypeScript Project Environment Setup

1. Create Project Folder

mkdir (folder_name)
cd (folder_name)

2. Initialize Inside Project Folder

npm init -y

3. Install TypeScript

npm install typescript --save-dev

4. Create .json File in Project Root Directory and Paste

//tsconfig.json
//Properties within compilerOptions can be customized
{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "sourceMap": true,
    "outDir": "./dist"
  },
  "include": ["src/**/*"]
}

5. Create .ts File Inside src Folder and Write TypeScript Code

2. Setting Up TypeScript ESLint and Prettier

1. Install ESLint, Then Apply Settings Below to settings.json

2. Disable 'format on save' Setting in VSCode Editor Settings

3. Install Prettier, Then Install Presets and Libraries

4. Create .eslintrc.js File Under Project Folder and Paste Content Below

Last updated