<commit_before>// Type definitions for history v2.0.0
// Project: https://github.com/rackt/history
// Definitions by: <NAME> <https://github.com/sergey-buturlakin>, <NAME> <https://github.com/ngbrown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped


declare namespace HistoryModule {

    // types based on https://github.com/rackt/history/blob/master/docs/Terms.md

    type Action = string

    type BeforeUnloadHook = () => string | boolean

    type CreateHistory<T> = (options?: HistoryOptions) => T

    type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>

    interface History {
        listenBefore(hook: TransitionHook): () => void
        listen(listener: LocationListener): () => void
        transitionTo(location: Location): void
        push(path: LocationDescriptor): void
        replace(path: LocationDescriptor): void
        go(n: number): void
        goBack(): void
        goForward(): void
        createKey(): LocationKey
        createPath(path: LocationDescriptor): Path
        createHref(path: LocationDescriptor): Href
        createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location

        /** @deprecated use a location descriptor instead */
        createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
        /** @deprecated use location.key to save state instead */
        pushState(state: LocationState, path: Path): void
        /** @deprecated use location.key to save state instead */
        replaceState(state: LocationState, path: Path): void
        /** @deprecated use location.key to save state instead */
        setState(state: LocationState): void
        /** @deprecated use listenBefore instead */
        registerTransitionHook(hook: TransitionHook): void
        /** @deprecated use the callback returned from listenBefore instead */
        unregisterTransitionHook(hook: TransitionHook): void
    }

    type HistoryOptions = {
        getCurrentLocation?: () => Location
        finishTransition?: (nextLocation: Location) => boolean
        saveState?: (key: LocationKey, state: LocationState) => void
        go?: (n: number) => void
        getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void
        keyLength?: number
        queryKey?: string | boolean
        stringifyQuery?: (obj: any) => string
        parseQueryString?: (str: string) => any
        basename?: string
        entries?: string | [any]
        current?: number
    }

    type Href = string

    type Location = {
        pathname: Pathname
        search: Search
        query: Query
        state: LocationState
        action: Action
        key: LocationKey
        basename?: string
    }

    type LocationDescriptorObject = {
        pathname?: Pathname
        search?: Search
        query?: Query
        state?: LocationState
    }

    type LocationDescriptor = LocationDescriptorObject | Path

    type LocationKey = string

    type LocationListener = (location: Location) => void

    type LocationState = Object

    type Path = string // Pathname + QueryString

    type Pathname = string

    type Query = { [key: string]: any; }

    type QueryString = string

    type Search = string

    type TransitionHook = (location: Location, callback: (result: any) => void) => any


    interface HistoryBeforeUnload {
        listenBeforeUnload(hook: BeforeUnloadHook): () => void
    }
<commit_msg>react-router: History.Location missed prop "hash" (#9567)<commit_after>// Type definitions for history v2.0.0
// Project: https://github.com/rackt/history
// Definitions by: <NAME> <https://github.com/sergey-buturlakin>, <NAME> <https://github.com/ngbrown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped


declare namespace HistoryModule {

    // types based on https://github.com/rackt/history/blob/master/docs/Terms.md

    type Action = string

    type BeforeUnloadHook = () => string | boolean

    type CreateHistory<T> = (options?: HistoryOptions) => T

    type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>

    interface History {
        listenBefore(hook: TransitionHook): () => void
        listen(listener: LocationListener): () => void
        transitionTo(location: Location): void
        push(path: LocationDescriptor): void
        replace(path: LocationDescriptor): void
        go(n: number): void
        goBack(): void
        goForward(): void
        createKey(): LocationKey
        createPath(path: LocationDescriptor): Path
        createHref(path: LocationDescriptor): Href
        createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location

        /** @deprecated use a location descriptor instead */
        createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
        /** @deprecated use location.key to save state instead */
        pushState(state: LocationState, path: Path): void
        /** @deprecated use location.key to save state instead */
        replaceState(state: LocationState, path: Path): void
        /** @deprecated use location.key to save state instead */
        setState(state: LocationState): void
        /** @deprecated use listenBefore instead */
        registerTransitionHook(hook: TransitionHook): void
        /** @deprecated use the callback returned from listenBefore instead */
        unregisterTransitionHook(hook: TransitionHook): void
    }

    type HistoryOptions = {
        getCurrentLocation?: () => Location
        finishTransition?: (nextLocation: Location) => boolean
        saveState?: (key: LocationKey, state: LocationState) => void
        go?: (n: number) => void
        getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void
        keyLength?: number
        queryKey?: string | boolean
        stringifyQuery?: (obj: any) => string
        parseQueryString?: (str: string) => any
        basename?: string
        entries?: string | [any]
        current?: number
    }

    type Href = string

    type Location = {
        pathname: Pathname
        search: Search
        query: Query
        state: LocationState
        action: Action
        key: LocationKey
        hash: Hash
        basename?: string
    }

    type LocationDescriptorObject = {
        pathname?: Pathname
        search?: Search
        query?: Query
        state?: LocationState
    }

    type LocationDescriptor = LocationDescriptorObject | Path

    type LocationKey = string

    type LocationListener = (location: Location) => void

    type LocationState = Object

    type Path = string // Pathname + QueryString

    type Pathname = string

    type Query = { [key: string]: any; }

    type QueryString = string

    type Search = string

    type TransitionHook = (location: Location, callback: (result: any) => void) => any

    type Hash = string


    interface HistoryBeforeUnload {
        listenBeforeUnload(hook: BeforeUnloadHook): () => void
    }

{'fraction_non_alphanumeric': 0.10706758465645637, 'fraction_numerical': 0.001405086412814388, 'mean_word_length': 2.8207192699946324, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 53, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4006903', 'n_tokens_mistral': 1821, 'n_tokens_neox': 1763, 'n_words': 552}