Skip to content

Commit 3aa8236

Browse files
committed
fix: Complete type definition
1 parent aec4f82 commit 3aa8236

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/RouterModel.d.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,34 @@ import { Model } from '@redux-model/web';
33
import { Reducers } from '@redux-model/web/core/utils/types';
44

55
interface Data {
6-
location: Location;
7-
action: Action;
6+
location: Location;
7+
action: Action;
88
}
99

1010
type UnsubscribeToken = string;
1111

1212
declare class RouterModel extends Model<Data> {
13-
push(path: Path, state?: LocationState): void;
14-
push<S = LocationState>(location: LocationDescriptorObject<S>): void;
15-
replace(path: Path, state?: LocationState): void;
16-
replace<S = LocationState>(location: LocationDescriptorObject<S>): void;
17-
go(index: number): void;
18-
goBack(): void;
19-
goForward(): void;
13+
// They are properties exactly.
14+
push(path: Path, state?: LocationState): void;
15+
push<S = LocationState>(location: LocationDescriptorObject<S>): void;
16+
replace(path: Path, state?: LocationState): void;
17+
replace<S = LocationState>(location: LocationDescriptorObject<S>): void;
18+
go(index: number): void;
19+
goBack(): void;
20+
goForward(): void;
2021

21-
subscribe<Params = any>(path: Path, fn: (params: Params, location: Location, action: Action) => void): UnsubscribeToken;
22-
unsubscribe(token: string): void;
22+
getHistory(): History;
23+
subscribe<Params = any>(path: Path, fn: (params: Params, location: Location, action: Action) => void): UnsubscribeToken;
24+
unsubscribe(token: string): void;
25+
registerBrowser(history?: History): Reducers;
26+
registerHash(history?: History): Reducers;
2327

24-
registerBrowser(history?: History): Reducers;
25-
registerHash(history?: History): Reducers;
28+
/**
29+
* @deprecated Use registerBrowser() or registerHash()
30+
*/
31+
register(): Reducers;
2632

27-
protected initReducer(): (() => Data) | Data;
33+
protected initReducer(): (() => Data) | Data;
2834
}
2935

3036
export declare const routerModel: RouterModel;

0 commit comments

Comments
 (0)