This is notes on typescript based off Andys lecture.
- Superset of Javascript
- All JS is valid TS
- JS with static typing
scss => sass transpiler => css
Node does not understand TS, so we need a compiler to turn it into JS ts => typescript transpiler => js
- Only accepts what you tell it to accept.
- Won't compile if what you input is not correct
- npm i -g typescript
- tsc -v will check typescript version
- tsc 01_basics.ts --target es2016
-
Make sure its on the top level floor
-
type
tsc --init
-
outDir
- determines where all of the js files will be outputed -
run
tsc
on any level to compile code -
Typically, gitignore the build files
This will automatically compile new js file when we save or make new tsc files
npx create-react-app my-app --template typescript
to create react app with typescript