Overview - What types exist only at compile time
What is it?
In TypeScript, some types exist only during the process of checking your code before it runs. These types help catch mistakes early but disappear when the program is turned into JavaScript to run. They do not create any code or data that runs in the browser or server. These are called compile-time-only types.
Why it matters
Without compile-time-only types, developers would have to find errors by running the program, which can be slow and error-prone. These types help catch bugs early, making code safer and easier to maintain. Without them, programs would be more likely to crash or behave unexpectedly in real use.
Where it fits
Before learning about compile-time-only types, you should understand basic TypeScript types and how TypeScript compiles to JavaScript. After this, you can learn about advanced type features like conditional types, mapped types, and type inference that build on compile-time-only types.