compile time
The moment source code is checked and translated by a compiler, before the program runs, as opposed to run time.
In more detail
Mistakes caught at compile time, such as a wrong type or a missing name, are reported before the program ever runs. Some languages, such as TypeScript, check types only at compile time and remove them from the output. So anything that arrives while the program runs, such as a JSON response, is unchecked until runtime validation checks it.
Related terms
- build time and run time — Build time is when software, such as a container image, is built and run time is when it is actually running, and every setting belongs to one or the other.
- TypeScript — JavaScript with added type annotations, checked by a compiler before the code runs.
- type checking — The compiler’s job of proving that every value in the code is used in a way its type allows.
- run time — The moment when a program is actually executing, as opposed to when it is written, compiled or built.
- compiler — A program that translates source code a person wrote into a form a machine or runtime can execute, checking it for errors on the way.
- type erasure — The removal of all TypeScript types when code is compiled, so none of them exist while the JavaScript runs.
Taught in
- End-to-End Type Safety: Shared Schemas & DTOs — Production Full-Stack Engineering
- Type-Safe RPC Architectures: tRPC & Procedures — Production Full-Stack Engineering
- Containerization Architecture: Multi-Stage Dockerfiles — Production Full-Stack Engineering
- Why TypeScript: Contracts, Erased Types And Soundness — Production TypeScript
- tsconfig.json: target, lib, strict And NodeNext — Production TypeScript
- Verify Your Environment: Running tsc And Bun TypeScript — Production TypeScript
- Literal Types: String, Number, Boolean Literals And const — Production TypeScript
- void, undefined And null: Exact Optional Property Types — Production TypeScript
- never: The Bottom Type And Exhaustive Switch Checking — Production TypeScript
- Optional Properties, Readonly And Index Signatures — Production TypeScript
- Tuples: Fixed Length, Labeled Elements And Variadic Tuples — Production TypeScript
- Assertion Signatures: asserts condition And Invariants — Production TypeScript
- Exhaustive Narrowing With never In Production Handlers — Production TypeScript
- Generic Interfaces, Classes And Type Aliases — Production TypeScript
- Generic Constraints: extends, keyof And Indexed Access — Production TypeScript
- Default Generic Arguments And Multi-Type Parameters — Production TypeScript
- Const Type Parameters: Retaining Literal Types In Functions — Production TypeScript
- Union Utilities: Exclude, Extract, NonNullable And Awaited — Production TypeScript
- Function Utilities: ReturnType, Parameters And Constructor — Production TypeScript
- Conditional Types: Ternary Types And Type Inference With infer — Production TypeScript
- Mapped Types, Key Remapping With as And Template Literals — Production TypeScript