repsweet080303 / typescript-learning

0 stars 0 forks source link

TypeScript for new programer #11

Open repsweet080303 opened 1 year ago

repsweet080303 commented 1 year ago

TypeScript: A Static Type Checker

Detecting errors in code without running it is referred to as static checking.

Determining what’s an error and what’s not based on the kinds of values being operated on is known as static type checking.

TypeScript checks a program for errors before execution

A Typed Superset of JavaScript

TypeScript is a language that is a superset of JavaScript: JS syntax is therefore legal TS.

Runtime Behavior

TypeScript is also a programming language that preserves the runtime behavior of JavaScript.

This means that if you move code from JavaScript to TypeScript, it is guaranteed to run the same way, even if TypeScript thinks that the code has type errors.

Keeping the same runtime behavior as JavaScript is a foundational promise of TypeScript because it means you can easily transition between the two languages without worrying about subtle differences that might make your program stop working.

Learning JavaScript and TypeScript

You can’t learn TypeScript without learning JavaScript! TypeScript shares syntax and runtime behavior with JavaScript, so anything you learn about JavaScript is helping you learn TypeScript at the same time.