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

@typedly/hooks

v2.0.0

Published

A TypeScript type definitions package for managing hooks.

Downloads

8

Readme

@typedly/hooks

npm version GitHub issues GitHub license

A TypeScript type definitions package for managing hooks @typescript-package/hooks.

Table of contents

Installation

The package

npm install @typedly/hooks --save-peer

Api

import {
  // Lifecycle.
  // After.
  AfterAllHook,
  AfterEachHook,
  // Before.
  BeforeAllHook,
  BeforeEachHook,

  AddHook,
  ChangeHook,
  ClearHook,
  DeleteHook,
  DestroyHook,
  GetHook,
  LockHook,
  ReplaceHook,
  SetHook,
  UnlockHook,
  UpdateHook,

  // Specialized for properties.
  PropertyChangeHook,
  SetPropertyHook,

  // Composite.
  Hooks,
  ObjectHooks,

  // Types.
  AllHooks,
  HookNames
} from '@typedly/hooks';

Interface

AfterAllHook

The shape of the after all hook.

import { AfterAllHook } from '@typedly/hooks';

Source

AfterEachHook

The shape of the after each hook.

import { AfterEachHook } from '@typedly/hooks';

Source

BeforeAllHook

The shape of the before all hook.

import { BeforeAllHook } from '@typedly/hooks';

Source

BeforeEachHook

The shape of the before each hook.

import { BeforeEachHook } from '@typedly/hooks';

Source

AddHook

The AddHook interface defines a Lifecycle hook for managing the addition of item of type T.

import { AddHook } from '@typedly/hooks';

Source

ClearHook

The shape of the clear hook.

import { ClearHook } from '@typedly/hooks';

Source

DeleteHook

The shape of the delete hook.

import { DeleteHook } from '@typedly/hooks';

Source

GetHook

The shape of the get hook.

import { GetHook } from '@typedly/hooks';

Source

LockHook

The shape of the lock hook.

import { LockHook } from '@typedly/hooks';

Source

ReplaceHook

The shape of the replace hook.

import { ReplaceHook } from '@typedly/hooks';

Source

ChangeHook

The ChangeHook interface defines a lifecycle hook for managing changes of an object of type T.

import { ChangeHook } from '@typedly/hooks';

Source

DestroyHook

The DestroyHook interface defines a lifecycle hook for managing the destruction of an object of type T.

import { DestroyHook } from '@typedly/hooks';

Source

Hooks

The Hooks interface defines a set of lifecycle hooks for managing changes and destruction of an object of type T.

import { Hooks } from '@typedly/hooks';

class SampleClass<T extends number> implements Hooks<T> {
  public onChange(callbackfn?: ((value: T, oldValue: T) => void) | undefined): this {
    return this;
  }
  public onDestroy(callbackfn?: (() => void) | undefined): this {
    return this;
  }
  public onSet(callbackfn?: ((value: T, oldValue?: T) => T) | undefined): this {
    return this;
  }
}

Source

ObjectHooks

The ObjectHooks interface defines a set of lifecycle hooks for managing changes to properties of an object of type T.

import { ObjectHooks } from '@typedly/hooks';

class SampleClass<T extends { 'someKey': any }> implements ObjectHooks<T> {
  public onPropertyChange<K extends keyof T>(key: K, callbackfn?: ((value: T[K], oldValue: T[K]) => void) | undefined): this {
    return this;
  }
  public onSetProperty<K extends keyof T>(key: K, callbackfn?: ((value: T[K], oldValue: T[K]) => T[K]) | undefined): this {
    return this;
  }
}

Source

PropertyChangeHook

The PropertyChangeHook interface defines a lifecycle hook for managing changes to specific properties of an object of type T.

import { PropertyChangeHook } from '@typedly/hooks';

Source

SetHook

The SetHook interface defines a lifecycle hook for managing the setting of a value of type T.

import { SetHook } from '@typedly/hooks';

Source

SetPropertyHook

The SetPropertyHook interface defines a lifecycle hook for managing the setting of a property value of an object of type T.

import { SetPropertyHook } from '@typedly/hooks';

Source

UnlockHook

The shape of the unlock hook.

import { UnlockHook } from '@typedly/hooks';

Source

UpdateHook

The shape of update hook.

import { UpdateHook } from '@typedly/hooks';

Source

Type

AllHooks

The all hooks type.

import { AllHooks } from '@typedly/hooks';

Source

HookNames

import { HookNames } from '@typedly/hooks';

Source

Contributing

Your contributions are valued! If you'd like to contribute, please feel free to submit a pull request. Help is always appreciated.

Support

If you find this package useful and would like to support its and general development, you can contribute through one of the following payment methods. Your support helps maintain the packages and continue adding new.

Support via:

or via Trust Wallet

Thanks for your support!

Code of Conduct

By participating in this project, you agree to follow Code of Conduct.

GIT

Commit

Versioning

Semantic Versioning 2.0.0

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards-compatible manner, and
  • PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

FAQ How should I deal with revisions in the 0.y.z initial development phase?

The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.

How do I know when to release 1.0.0?

If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.

License

MIT © typedly (license)

Related packages