Web Development/TypeScript (4) 썸네일형 리스트형 Section 5: Classes & Interfaces Section 4: Next-generation JavaScript & TypeScript "let" and "const" Define constants variables defined with const cannot be changed TypeScript throws error before runtime (as opposed to JavaScript) you shouldn't use var anymore let --> scope in which this variable is available variables = global and function scope if (age > 20) { var isOld = true; } console.log(isOld); // error function add(a: number, b: number) { let result; result = a + b; re.. Section 3: The TypeScript Compiler (and its Configuration) Compile tsc app.ts Watch changes Save -> automatically recompile tsc app.ts -w Compile multiple files Only require once initialize a typescript project everything in this folder is managed by typescript creates tsconfig.json file tsc --init Compile all typescript files in the project tsc tsc -w Including and excluding files Change in tsconfig.json node_modules is automatically excluded by defaul.. Section 1: Getting Started What is TypeScript? a JavaScript superset a language building up on JavaScript Adds new Features + Advantages to JavaScript Browser CAN'T execute it Typescript is compiled to JavaScript Features are compiled to JS "workarounds", possible errors are thrown Adds Types Next-gen JavaScript Features (compiled down for older Browsers) Non-JavaScript Features like Interfaces or Generics Meta-programmin.. 이전 1 다음