UNPKG

enchanted-next-router

Version:

✨ Polished API for Next.js Router

19 lines (18 loc) 791 B
/// <reference types="node" /> import { UrlObject } from 'url'; import NextRouter, { NextRouter as INextRouter, SingletonRouter } from 'next/router'; import { push, replace } from './router'; export declare type Url = UrlObject | string; export declare type TransitionOptions = Parameters<typeof NextRouter.push>[2]; export declare type EnchantedFunctions = { push: typeof push; replace: typeof replace; }; export declare type EnchantedSingletonRouter = Omit<SingletonRouter, 'push' | 'replace'> & EnchantedFunctions; export declare type EnchantedRouter<P> = Omit<INextRouter, 'push' | 'replace'> & EnchantedFunctions & { fullQuery: INextRouter['query']; queryString: string | undefined; /** hash from url works only on client-size */ hash: string; params: P; };