A types utility belt for TypeScript

Usage no npm install needed!

<script type="module">
  import typeCore from 'https://cdn.skypack.dev/type-core';



Version Build Status Coverage Dependencies Vulnerabilities License Types

A types utility belt for TypeScript.


npm install type-core


  • Primitives
    • ID
    • NonDefined
    • Nullish
    • Empty
    • FalseLike
    • Primitive
  • Serial
    • Serial.Type
    • Serial.Primitive
    • Serial.Array
    • Serial.Object
  • Structural
    • Dictionary
    • Constructor
    • MaybePromise
    • MaybePromiseLike
  • Functions
    • NullaryFn
    • UnaryFn
    • BinaryFn
    • MultiaryFn
    • VariadicFn
  • Utils
    • Union
    • Intersection
    • KeyOf
    • ValueOf
    • Index
    • Replace
    • Optional
    • Deep.Required
    • Deep.Partial



See source.

An exported object with methods:

  • isID(item: any): item is ID
  • isNullish(item: any): item is Nullish
  • isEmpty(item: any): item is Empty
  • isFalseLike(item: any): item is FalseLike
  • isPrimitive(item: any): item is Primitive: includes bigint, boolean, number, string, symbol, null, and undefined.
  • isNull(item: any): item is null
  • isUndefined(item: any): item is undefined
  • isBoolean(item: any): item is boolean
  • isString(item: any): item is string
  • isNumber(item: any): item is number
  • isBigInt(item: any): item is bigint
  • isSymbol(item: any): item is symbol
  • isFunction(item: any): item is VariadicFn
  • isObjectLike(item: any): item is any: excludes null, includes array and function.
  • isObject(item: any): item is any: excludes null, includes array.
  • isRecordLike(item: any): item is Members<unknown>, excludes null and array, includes function.
  • isRecord(item: any): item is Members<unknown>: excludes null, array, and function.
  • isArray(item: any): item is unknown[]
  • isPromiseLike(item: any): item is PromiseLike<unknown>: item is a thenable.
  • isPromise(item: any): item is Promise<unknown>: item is a Promise.
  • isIterable(item: any): item is Iterable<unknown>
  • isAsyncIterable(item: any): item is AsyncIterable<unknown>
  • isIterator(item: any): item is Iterator<unknown, unknown, unknown>
  • isEventEmitterLike(item: any): item is Partial<NodeJS.EventEmitter>
  • isEventEmitter(item: any): item is NodeJS.EventEmitter
  • isEventTarget(item: any): item is EventTarget