npm.io
3.0.3 • Published 2 years ago

@types/url-state

Licence
MIT
Version
3.0.3
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/url-state

Summary

This package contains type definitions for url-state (https://github.com/jessetane/url-state).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/url-state.

index.d.ts

import { parse } from "qs";

interface ReplaceHref {
    pathname?: string;
    query?: string;
    params?: string;
    hash?: string;
}

interface PushHref extends ReplaceHref {
    replace?: boolean;
}

interface UrlState
    extends Pick<URL, "href" | "protocol" | "hostname" | "port" | "pathname" | "search" | "hash" | "host" | "origin">
{
    readonly back: boolean;
    readonly params: ReturnType<typeof parse>;

    push(href: string | PushHref, replace?: boolean): void;
    replace(href: string | ReplaceHref): void;
    pop(): void;
    query(params: Record<string, string | null>, replace?: boolean): void;
}

declare class UrlState extends EventTarget {}
declare const urlState: UrlState;

export default urlState;

Additional Details

  • Last updated: Tue, 07 Nov 2023 1536 GMT
  • Dependencies: @types/qs

Credits

These definitions were written by tpluscode.