Type checking
Type checking is the process of determining whether a value or program construct satisfies the constraints of a type system.
Secrets of the JavaScript Ninja, Third Edition
The process of verifying that expressions, values, and operations conform to a language's declared or inferred type rules.
- How it is used
- Catches predictable type mismatches before JavaScript runtime as a coding practice alongside linting and testing.
- How deep it goes
- Works through compiler setup, an argument-type diagnostic, and checking versus execution, but defers detailed configuration options.
- Examples
- Uses a string passed to a number-typed function and a `setTimeout` call with its arguments reversed.
- What you can do after
- Operate/configure it with `tsconfig.json` and `npx tsc`, while retaining separate checks when running type-stripped code.
Read how Secrets of the JavaScript Ninja, Third Edition explains type checking →
Kotlin in Action, 2E
A type check is a Kotlin operation that tests whether a value has a specified runtime type.
- How it is used
- Uses `is` to select subtype-specific behavior while safely accessing members in the successful branch.
- How deep it goes
- Explains smart casts and their stability constraint, then details runtime limits caused by generic type erasure.
- Examples
- Demonstrates recursive `Expr` evaluation, checking an `Any` value for `String`, and distinguishing lists from sets.
- What you can do after
- Apply `is` and smart casts for subtype handling while avoiding invalid assumptions about erased generic arguments.
The Quick Python Book, Fourth Edition
Type checking is the analysis of program values and operations to detect whether they conform to expected types.
- How it is used
- Enforces expected types in Python functions and custom collections while contrasting explicit checks with duck typing.
- How deep it goes
- Works through type comparisons, typed-list checks, and collection initialization, while leaving a complete list implementation unfinished.
- Examples
- Uses string-versus-integer comparisons, a typed list, and a string-only URL-to-page dictionary.
- What you can do after
- Build type checks into custom Python collections and evaluate when duck typing may offer more flexibility.
Read how The Quick Python Book, Fourth Edition explains type checking →
Type-Driven Development with Idris
Type checking is the process of verifying that a program satisfies the constraints imposed by its types.
- How it is used
- Verifies that implementations obey type constraints, supporting valid state transitions and guiding incremental function construction.
- How deep it goes
- Checks expressions against expected types after evaluating both, using equality proofs when type-level arithmetic cannot reduce far enough.
- Examples
- Uses ATM state transitions and vector types with arithmetic expressions to illustrate guarantees and type mismatches.
- What you can do after
- Diagnose type mismatches by inspecting expected types and evaluating type-level expressions in Idris’s REPL.
Read how Type-Driven Development with Idris explains type checking →
Essential TypeScript 5, Third Edition
Type checking is the analysis of program values and expressions to determine whether their types satisfy language rules.
- How it is used
- Uses static analysis to catch incompatible values while developing TypeScript, JavaScript integrations, and React applications.
- How deep it goes
- Explains annotations, inference, unions, narrowing, object shapes, and configuration, while stopping short of compiler implementation internals.
- Examples
- Uses a cart formatter receiving strings, an ensuing toFixed runtime error, and a React tsconfig with strict and noEmit.
- What you can do after
- Diagnose/debug with it by identifying unchecked JavaScript boundaries and separating TypeScript type errors from Babel transformation.
Read how Essential TypeScript 5, Third Edition explains type checking →
Julia as a Second Language
Type checking is the process of verifying that operations are applied to compatible types.
- How it is used
- Uses runtime checks to constrain Julia method arguments and fields while retaining flexibility through type parameters.
- How deep it goes
- Contrasts static and runtime checks and works through parametric methods; defers further detail on field annotations’ performance implications.
- Examples
- Demonstrates an integer-vector search with a string mismatch and a two-dimensional vector with annotated displacement fields.
- What you can do after
- Apply type checking through Julia parametric methods and field annotations to constrain search arguments and vector fields.
Read how Julia as a Second Language explains type checking →
Refactoring to Rust
Type checking is the process of verifying that values and operations conform to the rules of a type system.
- How it is used
- Uses typed Rust structs to validate JSON data during deserialization.
- How deep it goes
- Explains inference, trait requirements, and runtime mismatch errors, but defers broader Serde configuration options.
- Examples
- Demonstrates typed `Data` structs, compiler diagnostics, and a JSON string whose `name` field incorrectly contains text.
- What you can do after
- Diagnose JSON type mismatches using compiler messages and Serde's line-and-column runtime errors.
Also covered in
- React in Depth
- Vibe EngineeringIn early access (MEAP)
- 100 C++ Mistakes and How to Avoid Them
- Python How-To
- Clojure: The Essential Reference
- Go in Action, Second Edition
- Authorization in Action
- Practices of the Python Pro
- Akka in Action, Second Edition
- Learn Rust in a Month of Lunches
What to know first
- inheritanceInheritance is a mechanism in which a derived type or descendant element receives properties or behavior from a parent, subject to rules that may allow specialization or overriding.
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- enumAn enum is a type whose values are selected from a finite set of named alternatives.
Related concepts
- smart castproduces · A smart cast is Kotlin's flow-sensitive automatic refinement of a value's type after a relevant type condition is established.
- TypeScriptused by · TypeScript is a statically typed superset of JavaScript that adds type-system features and is compiled to JavaScript.
- any typecontrasts with · The any type is a TypeScript type that permits values to be treated as having essentially any type, largely disabling static type checking for them.
- type hintsused by · Type hints are source-code annotations that indicate the intended or expected types of program elements, with enforcement depending on the language and tools.
- TypeScript compilerused by · The TypeScript compiler analyzes and checks TypeScript source code and can emit JavaScript and declaration files.
Questions about type checking
What is type checking?
Type checking is the process of determining whether a value or program construct satisfies the constraints of a type system.
Which Manning books explain type checking?
Secrets of the JavaScript Ninja, Third Edition, Kotlin in Action, 2E, The Quick Python Book, Fourth Edition, Type-Driven Development with Idris, Essential TypeScript 5, Third Edition, Julia as a Second Language and Refactoring to Rust.
What should I know before learning type checking?
Manning books that teach type checking usually introduce inheritance, Python, enum and Java first.
What is the difference between type checking and any type?
Type checking is the process of determining whether a value or program construct satisfies the constraints of a type system. The any type is a TypeScript type that permits values to be treated as having essentially any type, largely disabling static type checking for them.
What is type checking also called?
Type checking is also called type checks.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.






