npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@klyper/types

v0.3.0

Published

Klyper types package.

Downloads

27

Readme

@klyper/types

Shared TypeScript type aliases and runtime type guards for Klyper packages.

Use this package when a module needs small, dependency-free helpers for narrowing unknown values or reusing common utility types.

Installation

npm install @klyper/types

This package is published as an ES module package and also exposes a CommonJS entry through main.

Usage

import { isPlainObject, isString, type } from "@klyper/types";

const value: unknown = { title: "Klyper" };

if (isPlainObject(value) && isString(value.title)) {
  value.title.toUpperCase();
}

type(value); // "object"

The runtime helpers accept unknown values and return TypeScript type predicates where possible.

Runtime API

Type detection

| Export | Description | | --- | --- | | type(value) | Returns a normalized logical type name. null and undefined both return "null". |

Recognized logical type names include "array", "asyncfunction", "bigint", "boolean", "date", "error", "function", "map", "null", "number", "object", "promise", "regexp", "set", "string", "symbol", "weakmap", and "weakset".

Type guards

| Export | Narrows to | Notes | | --- | --- | --- | | isArray(value) | Array<any> | Checks array values. | | isAsyncFunction(value) | TypeAnyAsyncFunction | Checks functions declared with async. | | isBigInt(value) | bigint | Checks bigint primitives. | | isBoolean(value) | boolean | Checks boolean primitives. | | isConstructor(value) | TypeAnyConstructor | Checks functions whose prototype constructor points back to the function. | | isDate(value) | Date | Checks Date instances. | | isDef<T>(value) | T | Returns false for null and undefined. | | isError(value) | Error | Checks Error instances. | | isFiniteNumber(value) | number | Checks finite number primitives. | | isFloat(value) | number | Checks finite numbers with a fractional part. | | isFunction(value) | TypeAnyFunction | Checks callable values. | | isInteger(value) | number | Checks integer number primitives. | | isMap<K, V>(value) | Map<K, V> | Checks Map instances. | | isNil(value) | null \| undefined | Checks only null and undefined. | | isNonEmptyArray<T>(value) | [T, ...Array<T>] | Checks arrays with at least one item. | | isNull(value) | null | Checks only null. | | isNumber(value) | number | Checks number primitives, including NaN and infinities. | | isNumberLike(value) | boolean | Checks strings that represent finite decimal numbers. Scientific, binary, hex, NaN, and Infinity strings are rejected. | | isObject(value) | TypeAnyObject | Checks values whose normalized logical type is "object", including object literals, Object.create(null), and class instances. Arrays, maps, sets, dates, and regexps are excluded. | | isPlainObject(value) | TypeAnyObject | Checks object literals and Object.create(null) values. Class instances are excluded. | | isPromise<T>(value) | Promise<T> | Checks Promise instances, not arbitrary thenables. | | isRegExp(value) | RegExp | Checks regular expressions. | | isScalar(value) | TypeScalar | Checks boolean, number, and string values. | | isSet<T>(value) | Set<T> | Checks Set instances. | | isString(value) | string | Checks string primitives. | | isSymbol(value) | symbol | Checks symbol primitives. | | isUndefined(value) | undefined | Checks only undefined. |

Type Aliases

Common exported type aliases include:

import type {
  TypeAnyAsyncFunction,
  TypeAnyConstructor,
  TypeAnyFunction,
  TypeAnyObject,
  TypeCallback,
  TypeNullable,
  TypeName,
  TypeObjectOptional,
  TypeObjectRequired,
  TypeScalar,
} from "@klyper/types";

Notable groups:

  • Array aliases: TypeArray, TypeAnyArray, TypeFunctionArray, TypeNumberArray, TypeObjectArray, and TypeStringArray.
  • Object aliases: TypeObject, TypeAnyObject, TypeBooleanObject, TypeFunctionObject, TypeNumberObject, and TypeStringObject.
  • Object shape helpers: TypeObjectOptional, TypeObjectRequired, TypeObjectKeys, and TypeObjectKeysFunction.
  • Callback aliases: TypeCallback, TypeCallbackArray, TypeCallbackMap, and TypeCallbackObject.
  • Value helpers: TypeKey, TypeNullable, TypeOptional, and TypeScalar.

Primitive guards such as isString, isNumber, isBoolean, isBigInt, and isSymbol only accept primitives. Boxed wrappers such as new String("x"), new Number(1), and new Boolean(false) return false.

Commands

npm run build --workspace @klyper/types
npm run check --workspace @klyper/types
npm run lint --workspace @klyper/types
npm test --workspace @klyper/types

build uses Rollup for the package output. check runs TypeScript without emitting files.

Validation

Run the package checks before publishing or changing exports:

npm run check --workspace @klyper/types
npm test --workspace @klyper/types