liveBook · Manning

Typeof operator

A typeof operator obtains type information about an operand or expression, yielding a type or a string describing its type depending on the language.

How 3 Manning books explain it

Modern C, Third Edition

typeof is a C type operator that derives a type from an expression or type name without evaluating an expression operand.

How it is used
Supplies expression-derived types for generic macros, type checks, result conversions, and an explicit enumeration underlying type.
How deep it goes
Works through declarations and macro type matching, including evaluation and qualifier cautions, rather than detailing every typeof edge case.
Examples
Uses a declaration inferred from `3*x`, a static-assertion compatibility macro, and an enumeration typed from a decimal constant.
What you can do after
Build it from scratch: use typeof with _Generic to check macro-argument types without evaluating the arguments.

Read how Modern C, Third Edition explains typeof operator →

Essential TypeScript 5, Third Edition

The typeof operator is a JavaScript operator that produces a string identifying the type category of a value.

How it is used
Identifies a value’s runtime type while demonstrating JavaScript’s dynamic typing.
How deep it goes
Demonstrates primitive results and the null exception, but stops short of broader object and function-type behavior.
Examples
Uses index.js and index.ts listings that inspect strings, numbers, booleans, undefined, and a changing variable.
What you can do after
Diagnose/debug with it by checking a value’s runtime category and spotting unexpected assignments before calculations fail.

Read how Essential TypeScript 5, Third Edition explains typeof operator →

Pro Angular 16

The typeof operator is a JavaScript operator that returns a string identifying the type of its operand.

How it is used
Uses runtime checks to validate function arguments and select operations for number, string, or object values.
How deep it goes
Demonstrates guards, errors, union-type branches, and object limitations, but defers a complete catalog of returned type strings.
Examples
Uses numeric and string function arguments, union-type branches, and Product and DiscountProduct objects.
What you can do after
Diagnose unexpected argument types and branch safely before applying type-specific operations.

Read how Pro Angular 16 explains typeof operator →

Related concepts

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.