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

@real-router/types

v0.31.2

Published

Shared TypeScript types for Real Router ecosystem

Readme

@real-router/types

License: MIT TypeScript

TypeScript type definitions for Real-Router ecosystem. Provides shared types used by all @real-router/* packages.

Installation

This package is automatically installed as a dependency of @real-router/core. Direct installation is only needed for advanced use cases.

npm install @real-router/types

Usage

// Most users should import types from @real-router/core
import type { Router, State, Params } from "@real-router/core";

// Direct import is available for type-only scenarios
import type { State, Params, NavigationOptions } from "@real-router/types";

Exported Types

Core Router Types

| Type | Description | |------|-------------| | Router<D> | Full router interface with navigation, lifecycle, and plugin management | | Navigator | Minimal safe subset of Router methods for passing to components | | State<P> | Current route state with name, params, and metadata | | Params | Route parameters object (string key-value pairs) | | NavigationOptions | Options for navigation (e.g., replace, skipGuards) | | RouterError | Error thrown during navigation failures |

Lifecycle & Guards

| Type | Description | |------|-------------| | GuardFn | (toState: State, fromState?: State, signal?: AbortSignal) => boolean \| Promise<boolean> — route activation/deactivation guard | | GuardFnFactory<D> | Factory function that creates a GuardFn with dependency injection |

Subscription & Listeners

| Type | Description | |------|-------------| | SubscribeFn | (state: SubscribeState) => void — callback for route changes via router.subscribe() | | SubscribeState | { route: State, previousRoute?: State } — argument passed to SubscribeFn | | LeaveFn | (state: LeaveState) => void — callback for leave events via router.subscribeLeave() | | LeaveState | { route: State, nextRoute: State } — argument passed to LeaveFn | | Unsubscribe | () => void — function to unsubscribe from listeners |

Plugin System

| Type | Description | |------|-------------| | Plugin | Plugin interface with optional lifecycle hooks | | PluginFactory<D> | Factory function that creates a Plugin with dependency injection | | Plugin.onTransitionLeaveApprove | Optional hook fired after leave guard confirms, before activation guards |

Route Configuration

| Type | Description | |------|-------------| | Route<D> | Route configuration with name, path, guards, and children | | RouteConfigUpdate<D> | Options for updating route configuration at runtime | | Options | Router initialization options (defaults, encoding, limits) |

Navigator Methods

| Method | Description | |--------|-------------| | Navigator.navigate() | Navigate to a named route with optional params | | Navigator.getState() | Get current route state | | Navigator.isActiveRoute() | Check if a route is currently active | | Navigator.canNavigateTo() | Check if navigation to a route is allowed | | Navigator.subscribe() | Subscribe to route changes | | Navigator.subscribeLeave() | Subscribe to leave events (fires after guard confirms) | | Navigator.isLeaveApproved() | Check if the current leave transition was approved |

Why This Package?

This package solves TypeScript type compatibility issues between @real-router/* packages:

  • Single source of truth — all packages share identical type definitions
  • No type duplication — types are not inlined into each package's .d.ts
  • Module augmentation works — plugins can extend Router interface correctly

Related Packages

License

MIT © Oleg Ivanov