---
source: https://iinventedlight.com/library/notes/typescript-narrowing.md
title: "TypeScript narrowing: typeof, instanceof, in, and type predicates"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (microsoft/TypeScript-Website); restated in our own words"
attribution: "Summary by iinventedlight (AI-assisted). Sources: TypeScript (Microsoft), TypeScript Handbook: Narrowing, CC BY 4.0 (microsoft/TypeScript-Website); TypeScript (Microsoft), Everyday Types, CC BY 4.0 (microsoft/TypeScript-Website)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-05
as_of: 2026-11-05
confidence: medium
untested: "Steps and code were not run; only the fetched documentation page was read."
category: coding-references
topic_area: "code-web: TypeScript type narrowing"
tags: typescript, javascript, types, narrowing
sources:
  - id: S1
    title: "TypeScript Handbook: Narrowing"
    publisher: TypeScript (Microsoft)
    url: https://www.typescriptlang.org/docs/handbook/2/narrowing.html
    accessed: 2026-11-05
    license: "CC BY 4.0 (microsoft/TypeScript-Website)"
  - id: S2
    title: "Everyday Types"
    publisher: TypeScript (Microsoft)
    url: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html
    accessed: 2026-11-05
    license: "CC BY 4.0 (microsoft/TypeScript-Website)"
    license: "CC BY 4.0 (microsoft/TypeScript-Website docs)"
---
# TypeScript narrowing

## Short answer
Narrowing is how TypeScript shrinks a union after checks such as `typeof`, `instanceof`, or a custom type predicate. [S1]

## Points
- `typeof` checks are type guards. [S1]
- In JavaScript, `typeof null` is `"object"`, which surprises people. [S1]
- `instanceof` is also a type guard. [S1]
- Union types let you build new types from existing ones; operations must be valid for every member. [S2]

## Claims
- id: C1
  claim: typeof checks act as type guards.
  source: S1
  evidence: "checking against the value returned by typeof is a type guard"
- id: C2
  claim: typeof null is object in JavaScript.
  source: S1
  evidence: "typeof null is actually "object""
- id: C3
  claim: instanceof is a type guard.
  source: S1
  evidence: "instanceof is also a type guard"
- id: C4
  claim: Operations on a union must be valid for every member.
  source: S2
  evidence: "valid for every member of the union"

## Sources
- [S1] TypeScript Handbook: Narrowing. TypeScript (Microsoft). https://www.typescriptlang.org/docs/handbook/2/narrowing.html . License: CC BY 4.0 (microsoft/TypeScript-Website). Accessed 2026-11-05.
- [S2] Everyday Types. TypeScript (Microsoft). https://www.typescriptlang.org/docs/handbook/2/everyday-types.html . License: CC BY 4.0 (microsoft/TypeScript-Website). Accessed 2026-11-05.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

Source notice: TypeScript Handbook / Website docs © Microsoft. Licensed under Creative Commons Attribution 4.0 International (https://github.com/microsoft/TypeScript-Website/blob/v2/LICENSE).
