# @types/hookrouter

> TypeScript definitions for hookrouter

Latest version **2.2.9** (published 2025-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/hookrouter
pnpm add @types/hookrouter
yarn add @types/hookrouter
bun add @types/hookrouter
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.2.9 |
| Published | 2025-11-18 |
| First published | 2019-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51449 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/hookrouter
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hookrouter
- npm.io page: https://npm.io/package/@types/hookrouter

## Dependencies (2)

- [csstype](https://npm.io/package/csstype.md) ^3.2.2
- [@types/react](https://npm.io/package/@types/react.md) *

## Recent versions

- 2.2.9 (latest) — 2025-11-18
- 2.2.8 (ts5.1) — 2023-11-07
- 2.2.5 (ts4.0) — 2020-11-23
- 2.2.7 — 2023-10-18
- 2.2.6 — 2023-09-16
- 2.2.4 — 2020-11-17
- 2.2.3 — 2020-07-31
- 2.2.2 — 2020-05-15
- 2.2.1 — 2019-05-17
- 2.2.0 — 2019-05-14

## README

# Installation
> `npm install --save @types/hookrouter`

# Summary
This package contains type definitions for hookrouter (https://github.com/Paratron/hookrouter).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hookrouter.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hookrouter/index.d.ts)
````ts
import * as React from "react";
export namespace HookRouter {
    type InterceptedPath = string | null;
    interface AProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
        href: string;
    }
    interface QueryParams {
        [key: string]: any;
    }
    interface RouteObject<T = any> {
        [key: string]: (params: QueryParams) => T;
    }
}
export function setLinkProps(props: HookRouter.AProps): HookRouter.AProps;
export function A(props: HookRouter.AProps): React.ReactHTMLElement<HTMLAnchorElement>;
export function confirmNavigation(): void;
export function resetPath(): void;
export function stopInterception(): void;
export function useControlledInterceptor(): [
    HookRouter.InterceptedPath,
    typeof confirmNavigation,
    typeof resetPath,
    typeof stopInterception,
];
export function interceptRoute(previousRoute: string, nextRoute: string): string[];
export function get(componentId: number): HookRouter.RouteObject | null;
export function remove(componentId: number): void;
export function useInterceptor(handlerFn: (currentPath: string, nextPath: string) => string): () => typeof remove;
export function setQueryParams(inObj: HookRouter.QueryParams, replace?: boolean): void;
export function getQueryParams(): HookRouter.QueryParams;
export function queryStringToObject(inStr: string): HookRouter.QueryParams;
export function objectToQueryString(inObj: HookRouter.QueryParams): string;
export function useQueryParams(): [HookRouter.QueryParams, typeof setQueryParams];
export function useRedirect(
    fromURL: string,
    toURL: string,
    queryParams?: HookRouter.QueryParams | null,
    replace?: boolean,
): void;
export function setBasepath(inBasepath: string): void;
export function getBasepath(): string;
export function resolvePath(inPath: string): string;
export function prepareRoute(inRoute: string): [RegExp, string[]];
export function navigate(
    url: string,
    replace?: boolean,
    queryParams?: HookRouter.QueryParams | null,
    replaceQueryParams?: boolean,
): void;
export function setPath(inPath: string): void;
export function getPath(): string;
export function usePath(active?: boolean, withBasePath?: boolean): string;
export function updatePathHooks(): void;
export function getWorkingPath(parentRouterId: string): string;
export function useRoutes<T = any>(routeObj: HookRouter.RouteObject<T>): T | null;
export function useTitle(inString: string): void;
export function getTitle(): string;

````

### Additional Details
 * Last updated: Tue, 18 Nov 2025 02:14:41 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react), [csstype](https://npmjs.com/package/csstype)

# Credits
These definitions were written by [Mete Can Eris](https://github.com/mcaneris), and [Sam Calvert](https://github.com/sam-outschool).

---
_Source: https://npm.io/package/@types/hookrouter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
