run time
The moment when a program is actually executing, as opposed to when it is written, compiled or built.
In more detail
For TypeScript, run time is when the emitted JavaScript executes in Node.js, Bun or a browser. Types exist only at compile time, so they add no run time cost but also cannot guard run time data. Checks on untrusted input must therefore be real JavaScript code that runs.
Example
typeof x === "string" is a run time check; x: string is a compile time annotationRelated terms
- compile time — The moment source code is checked and translated by a compiler, before the program runs, as opposed to run time.
- type erasure — The removal of all TypeScript types when code is compiled, so none of them exist while the JavaScript runs.
- runtime validation — Checking real data with JavaScript code while the program runs, so values from outside are proven correct before they are trusted.
- language runtime — The software a programming language needs installed to run programs, such as the Python interpreter or Node.js.
Taught in
- Why TypeScript: Contracts, Erased Types And Soundness — Production TypeScript
- The Compiler Pipeline: tsc, AST And Code Emission — Production TypeScript
- tsconfig.json: target, lib, strict And NodeNext — Production TypeScript
- Verify Your Environment: Running tsc And Bun TypeScript — Production TypeScript
- Primitive Types: String, Number, Boolean, Bigint And Symbol — Production TypeScript
- Literal Types: String, Number, Boolean Literals And const — Production TypeScript
- any Versus unknown: Defensive Typing In Practice — 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
- Union Types, Intersections And Property Conflicts — Production TypeScript
- The in Operator And Instanceof Narrowing — Production TypeScript
- Custom Type Predicates: Functions Returning is Type — Production TypeScript
- Assertion Signatures: asserts condition And Invariants — Production TypeScript
- Exhaustive Narrowing With never In Production Handlers — Production TypeScript
- Why Generics: Functions, Identities And Type Variables — Production TypeScript
- Generic Interfaces, Classes And Type Aliases — Production TypeScript
- Generic Constraints: extends, keyof And Indexed Access — Production TypeScript
- Const Type Parameters: Retaining Literal Types In Functions — Production TypeScript
- Union Utilities: Exclude, Extract, NonNullable And Awaited — Production TypeScript
- Conditional Types: Ternary Types And Type Inference With infer — Production TypeScript
- ECMAScript Modules, CJS Interop And verbatimModuleSyntax — Production TypeScript
- Declaration Files, Ambient Namespaces And Module Augmentation — Production TypeScript
- Modern Decorators: Stage 3 Standards And Class Metadata — Production TypeScript