/practice-typescript

Self learning in TypeScript fundamental.

Primary LanguageJavaScript

This project is for learning TypeScript.

What TypeScript? ๐Ÿ˜ต

  • Open-source programming language from Microsoft.
  • Typed superset of JavaScript.
  • Compiled down to plain JavaScript which is understood by browser.

Why TypeScript? ๐Ÿคจ

  • 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 TypeScript ๐Ÿšง

  1. Install node.js
  2. Run command: npm install -g typescript
  3. Run command: tsc -v (Optionals, to check typescript version.)

Compile .ts file ๐Ÿš€

  • 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

Summary in index.ts file with 6 topics ๐Ÿ“Œ

  1. Variable Declarations
  2. Variable Types
  3. Function
  4. Interface
  5. Class
  6. Class Access Modifiers