mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 14:59:37 +08:00
[history] Add overloads for History.block
History.block also accepts a string or a function which is used to determine the prompt.
This commit is contained in:
4
types/history/index.d.ts
vendored
4
types/history/index.d.ts
vendored
@@ -18,7 +18,7 @@ export interface History {
|
||||
go(n: number): void;
|
||||
goBack(): void;
|
||||
goForward(): void;
|
||||
block(prompt?: boolean): UnregisterCallback;
|
||||
block(prompt?: boolean | string | TransitionPromptHook): UnregisterCallback;
|
||||
listen(listener: LocationListener): UnregisterCallback;
|
||||
createHref(location: LocationDescriptorObject): Href;
|
||||
}
|
||||
@@ -48,6 +48,7 @@ export namespace History {
|
||||
export type Pathname = string;
|
||||
export type Search = string;
|
||||
export type TransitionHook = (location: Location, callback: (result: any) => void) => any;
|
||||
export type TransitionPromptHook = (location: Location, action: Action) => string | false | void;
|
||||
export type Hash = string;
|
||||
export type Href = string;
|
||||
}
|
||||
@@ -60,6 +61,7 @@ export type Path = History.Path;
|
||||
export type Pathname = History.Pathname;
|
||||
export type Search = History.Search;
|
||||
export type TransitionHook = History.TransitionHook;
|
||||
export type TransitionPromptHook = History.TransitionPromptHook;
|
||||
export type Hash = History.Hash;
|
||||
export type Href = History.Href;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user