Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’

Typescript Hot Reloading

tags: tutorials, typescript

Quick Set Up

  1. You'll want to tsc transpiler downloaded globaly. npm install -g typescript

create a new typescript workspace folder. This is where all of your TS files will live.

make a new directory in your TS workspace and open VSCode (code .)

  1. run git init and npm init

  2. run npm install

  3. run npm install --save-dev lite-server

  4. run npm start

edit the following in package.json

inside of "scripts" shell, add {"start": "lite-server", ...} โ€“ set your path: "main": app.js

  • Inside index.html, add this line. <script src="app.js" defer></script>
  1. create app.ts. write TS code, and compile using the command $tsc app.ts

Hot reload compilation

  1. run $tsc --init

  2. run $tsc --watch

  3. include or exclude files in your newly created tsconfig shell.

example script : tsconfig

โ€‹"exclude" : [
โ€‹   "types/analytics.ts",
โ€‹   "node_modules" //would be the default
โ€‹ ], 
โ€‹ "include": [
โ€‹   "types/app.ts" //include - exclude ( default )
โ€‹ ], 
โ€‹ "files": [
โ€‹   "types/basics.ts"
โ€‹ ]

  1. Organize your files; change your outDir: "dist" and rootDir: "src" in your tsconfig.json file.