Glossary
- Compile Time vs Runtime: We consider the time before your code is executed to be "Compile Time". Anything that happens in your program after you execute your code happens at runtime.
- Dynamic Types vs Static Types: Languages like Java and C++ expect variables to always be the same type after they are declared. They use static, or unchanging, types. Other languages, like JavaScript and Python, let you change the type of variables at runtime. These use dynamic types.
- Type Error: When the program throws an error because a value of one type was used when the program was expecting another type. This happens when we use numbers in place of strings or if we try to call a function, only to find out it is really
**undefined**
.
- Type Safety: Eliminating type errors by ensuring types are only used in the correct place. This usually happens by having a compiler warn you when you use a type in the wrong way. There are varying degrees of type safety, from incredibly rigid with a low chance of type errors to more flexible with a higher chance of type errors.
- Static Analysis or Static Validation: When a tool analyzes your code without executing it. This can give you some insights into ways to improve your code and can warn you of errors before you run your code.
- Compiler: A program which takes code and transforms it into another format. Typically compilers convert code into machine code which is run directly by the CPU, but other compilers, like TypeScript, convert from one programming language into another programming language.
- Type Annotations: Small bits of code that tell TypeScript what type a value or variable is.
- Type Declaration: A file with the .d.ts extension which only holds type definitions for a JavaScript library.