# sindresorhus/is architecture

> Architecture diagram of the GitHub repository sindresorhus/is, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sindresorhus/is
- Repository: https://github.com/sindresorhus/is

## Overview

`@sindresorhus/is` is a TypeScript runtime utility for detecting value types, checking predicates, and asserting types with TypeScript narrowing. A caller supplies a value to the exported API and receives a type name, boolean result, or an exception on failed assertion. The README documents broad predicate families, composable array checks, and assertions; these are implemented within the large `source/index.ts` module. `source/types.ts` supplies type definitions and `source/utilities.ts` supplies a key helper. The graph reflects documented capabilities; it does not imply separate runtime stages where the implementation is not shown.

Main entry points: [`source/index.ts`](https://github.com/sindresorhus/is/blob/main/source/index.ts) (Type detection), [`source/types.ts`](https://github.com/sindresorhus/is/blob/main/source/types.ts) (Type definitions), [`source/utilities.ts`](https://github.com/sindresorhus/is/blob/main/source/utilities.ts) (Key helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Type-check API"]
  node_runtime["Type detection<br/>[index.ts]"]
  node_guards["Type guards<br/>[index.ts]"]
  node_assertions["Type assertions<br/>[index.ts]"]
  node_collections["Collection checks<br/>[index.ts]"]
  node_emptiness["Emptiness checks<br/>[index.ts]"]
  node_special["Special checks<br/>[index.ts]"]
end

subgraph group_types["TypeScript support"]
  node_typesource["Type definitions<br/>[types.ts]"]
end

subgraph group_helpers["Internal helper"]
  node_keyhelper["Key helper<br/>[utilities.ts]"]
end

node_caller(("Library caller"))

node_caller -->|"detects type"| node_runtime
node_caller -->|"checks value"| node_guards
node_caller -->|"asserts type"| node_assertions
node_caller -->|"checks collections"| node_collections
node_caller -->|"checks emptiness"| node_emptiness
node_caller -->|"checks value"| node_special
node_runtime -->|"uses keysOf"| node_keyhelper
node_runtime -->|"imports types"| node_typesource

click node_runtime "https://github.com/sindresorhus/is/blob/main/source/index.ts"
click node_guards "https://github.com/sindresorhus/is/blob/main/source/index.ts"
click node_assertions "https://github.com/sindresorhus/is/blob/main/source/index.ts"
click node_collections "https://github.com/sindresorhus/is/blob/main/source/index.ts"
click node_emptiness "https://github.com/sindresorhus/is/blob/main/source/index.ts"
click node_special "https://github.com/sindresorhus/is/blob/main/source/index.ts"
click node_typesource "https://github.com/sindresorhus/is/blob/main/source/types.ts"
click node_keyhelper "https://github.com/sindresorhus/is/blob/main/source/utilities.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_guards,node_assertions,node_collections,node_emptiness,node_special toneBlue
class node_typesource toneAmber
class node_keyhelper toneMint
class node_caller toneIndigo
```

## Components

### Type-check API

- [Type detection](https://github.com/sindresorhus/is/blob/main/source/index.ts): `source/index.ts`
- [Type guards](https://github.com/sindresorhus/is/blob/main/source/index.ts): `source/index.ts`
- [Type assertions](https://github.com/sindresorhus/is/blob/main/source/index.ts): `source/index.ts`
- [Collection checks](https://github.com/sindresorhus/is/blob/main/source/index.ts): `source/index.ts`
- [Emptiness checks](https://github.com/sindresorhus/is/blob/main/source/index.ts): `source/index.ts`
- [Special checks](https://github.com/sindresorhus/is/blob/main/source/index.ts): `source/index.ts`

### TypeScript support

- [Type definitions](https://github.com/sindresorhus/is/blob/main/source/types.ts): `source/types.ts`

### Internal helper

- [Key helper](https://github.com/sindresorhus/is/blob/main/source/utilities.ts): `source/utilities.ts`

### Other components

- **Library caller**

## Connections

- Library caller → Type detection: detects type (evidence: `readme.md`)
- Library caller → Type guards: checks value (evidence: `readme.md`)
- Library caller → Type assertions: asserts type (evidence: `readme.md`)
- Library caller → Collection checks: checks collections (evidence: `readme.md`)
- Library caller → Emptiness checks: checks emptiness (evidence: `readme.md`)
- Library caller → Special checks: checks value (evidence: `readme.md`)
- Type detection → Key helper: uses keysOf (evidence: `source/index.ts`)
- Type detection → Type definitions: imports types (evidence: `source/index.ts`)
