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

custom-type

v2.0.2

Published

A collection of custom TypeScript types for use across projects

Readme

Custom Types for TypeScript

A collection of custom TypeScript types for use across projects, especially for React applications. This package contains common types for props, event handlers, and other utility types that can help streamline your TypeScript development.

Installation

To install the custom-types package, run the following command:

npm install custom-type --save-dev

Usage

After installing the package, you can import and use the custom types in your TypeScript files. The types provided in this package are useful for creating type-safe React components.

Example 1: Using ChildrenProps

import { ChildrenProps } from "custom-type";

const MyComponent: React.FC<ChildrenProps> = ({ children }) => {
  return <div>{children}</div>;
};

Example 2: Using TagNameProps

import { TagNameProps } from "custom-type";

const MyComponent: React.FC<TagNameProps> = ({ tagName }) => {
  const Tag = tagName;
  return <Tag>Some Content</Tag>;
};

// Usage
<MyComponent tagName="h1" />;

Example 3: Using CommonProps

import { CommonProps } from "custom-type";

interface ButtonProps extends CommonProps<HTMLButtonElement> {
  label: string;
}

const Button: React.FC<ButtonProps> = ({ label, className, ...props }) => {
  return (
    <button className={className} {...props}>
      {label}
    </button>
  );
};

// Usage
<Button label="Click me" id="submit-button" className="btn-primary" />;

Example 4: Using EventHandlerProps

import { EventHandlerProps } from "custom-type";

const MyComponent: React.FC<EventHandlerProps> = ({
  onClick,
  onMouseEnter,
}) => {
  return (
    <div onClick={onClick} onMouseEnter={onMouseEnter}>
      Hover and click me
    </div>
  );
};

// Usage
<MyComponent
  onClick={() => alert("Clicked!")}
  onMouseEnter={() => console.log("Mouse entered")}
/>;

Types Provided

  • ChildrenProps: Used to define a children prop of type React.ReactNode.
  • TagNameProps: Used to specify an HTML tag name (e.g., div, h1, etc.).
  • CommonProps<T>: A generic interface that defines common props for any HTML element, such as id, className, style, ref, and custom data- attributes.
  • LabelCommonProps: Interface for props used in labels, specifically for the htmlFor attribute.
  • EventHandlerProps<T>: A comprehensive set of event handlers for different types of DOM events, including mouse, keyboard, touch, form, and more.

License