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

ts-type-helpers

v1.0.0

Published

Additional types collection

Readme

ts-type-helpers

A collection of types which can help in the future project

Installation

npm install -D ts-type-helpers

Usage

ToObject

Fix unchecked indexes error in TS. Converts interface into object.

import { ToObject } from 'ts-type-helpers';

interface Int {
  a: string;
  b: number;
}

const fn = <T extends Record<string, unknown>>(arg: T) => arg;

fn<Int>; // Unchecked indexes error
fn<ToObject<Int>>; // Withot error

ArrayType

Extract an array union type

import { ArrayType } from 'ts-type-helpers';

ArrayType<Array<'a' | 'b' | 'c'>>; // 'a' | 'b' | 'c'
ArrayType<'a' | 'b' | 'c'>; // 'a' | 'b' | 'c'

Enumerated

Lists digits from zero to a set digit

import { Enumerated } from 'ts-type-helpers';

Enumerated<5>; // 0 | 1 | 2 | 3 | 4

IsEqual

Compares to types they are the same type Returns TPositive value or TNegative value

import { IsEqual } from 'ts-type-helpers';

IsEqual<{ str: string }, { num: number }, 1, 0>; // 0
IsEqual<{ str: string }, { str: string }, 1, 0>; // 1

EntitiesMap

Just a Record of types with the key type

import { EntitiesMap } from 'ts-type-helpers';

EntitiesMap<{ id: number; value: string }, number>; // Record<number, { id: number; value: string } | undefined>

NormalizedList

Type for normalized list with a manual key type

import { NormalizedList } from 'ts-type-helpers';

NormalizedList<{ id: number; value: string }, number>; // { ids: number[]; entities: Record<number, { id: number; value: string } | undefined> }
NormalizedList<{ id: number; value: string }, string>; // { ids: string[]; entities: Record<string, { id: number; value: string } | undefined> }

NormalizedListByKey

Type for normalized list which extract key type by its name in object

import { NormalizedListByKey } from 'ts-type-helpers';

NormalizedListByKey<{ id: number; value: string }, 'id'>; // { ids: number[]; entities: Record<number, { id: number; value: string } | undefined> }
NormalizedListByKey<{ id: number; value: string }, 'value'>; // { ids: string[]; entities: Record<string, { id: number; value: string } | undefined> }

PickByType

Pick object by parameters type

import { PickByType } from 'ts-type-helpers';

PickByType<{ foo: string; bar: number }, string>; // { foo: string }
PickByType<{ foo: string; bar: number }, number>; // { bar: number }

PickReadOnly

Pick only readonly parameters

import { PickReadOnly } from 'ts-type-helpers';

PickReadOnly<{ readonly a: string; b: string }>; // { readonly a: string; }

PickReadOnlyKeys

Returns keys of only readonly parameters

import { PickReadOnlyKeys } from 'ts-type-helpers';

PickReadOnlyKeys<{ readonly a: string; b: string }>; // 'a'

PickWritable

Pick parameters without readonly

import { PickReadOnly } from 'ts-type-helpers';

PickReadOnly<{ readonly a: string; b: string }>; // { b: string; }

PickWritableKeys

Returns keys of parameters without readonly

import { PickWritableKeys } from 'ts-type-helpers';

PickWritableKeys<{ readonly a: string; b: string }>; // 'b'

Range

Returns a range from TMin to TMax (without TMax)

import { Range } from 'ts-type-helpers';

Range<1, 5>; // 1 | 2 | 3 | 4

ToCamelCaseDict

Converts object keys from snake_case into camelCase

import { ToCamelCaseDict } from 'ts-type-helpers';

ToCamelCaseDict<{ readonly some_snake_case_str: string }>; // { readonly someSnakeCaseStr: string }

ToCamelCaseStr

Converts snake_case string into camelCase

import { ToCamelCaseStr } from 'ts-type-helpers';

ToCamelCaseStr<'some_snake_case_str'>; // 'someSnakeCaseStr'

UnionsToTuple

Converts unions to several lists of this unions Helps when you need enumerate unions in a list

import { UnionsToTuple } from 'ts-type-helpers';

UnionsToTuple<'a' | 'b'>; // ['a', 'b'] | ['b', 'a']