- Open-source programming language from Microsoft.
- Typed superset of JavaScript.
- Compiled down to plain JavaScript which is understood by browser.
- In general, variable in JavaScript is dynamic type that JavaScript doesn't know variable type until runtime.
- TypeScript is static type that knew variable type before runtime. so TypeScript able to handle type error better than js.
- Install node.js
- Run command:
npm install -g typescript
- Run command:
tsc -v
(Optionals, to check typescript version.)
- Run command:
tsc [filename].ts
- TypeScript will build .js file, so you can run .js file by node using command:
node [filename].js
- (Options) You can automatically recompile .ts file to .js file using command:
tsc [filename].ts --watch
- Variable Declarations
- Variable Types
- Function
- Interface
- Class
- Class Access Modifiers