Skip to content

TypeComplexity

Since 1.4.0

Type complexity analysis.

Signature

typescript
interface TypeComplexity<T, Depth extends 0[] = []> {
  depth: number
  branches: number
  nodes: number
}

Parameters

ParameterDescription
TType to analyze
DepthInternal depth counter

Description

Analyzes the complexity of a type for performance optimization.

Examples

Basic Usage

typescript
import type { TypeComplexity } from 'uni-types'

type Simple = TypeComplexity<string>
type Complex = TypeComplexity<{ a: { b: { c: string } } }>

Released under the MIT License.