From 1340339ce960f33eb98f39ec17c07b90787edb79 Mon Sep 17 00:00:00 2001 From: Nelson Javier Novoa Tellez Date: Mon, 22 Oct 2018 15:29:23 -0500 Subject: [PATCH] Extract action types to its own type. Change Histotyl.location property type from string to HistoryLocation to be accurate to current API --- types/reach__router/index.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/types/reach__router/index.d.ts b/types/reach__router/index.d.ts index b3f0e0f582..65d3fb0658 100644 --- a/types/reach__router/index.d.ts +++ b/types/reach__router/index.d.ts @@ -8,18 +8,19 @@ import * as React from "react"; import { Location as HLocation } from "history"; export type WindowLocation = Window["location"] & HLocation; +export type HistoryActionType = "PUSH" | "POP"; +export type HistoryLocation = WindowLocation & { state?: any }; +export type HistoryListenerParameter = { location: HistoryLocation, action: HistoryActionType }; +export type HistoryListener = (parameter: HistoryListenerParameter) => void; +export type HistoryUnsubscribe = () => void; + export interface History { - readonly location: string; + readonly location: HistoryLocation; readonly transitioning: boolean; listen: (listener: HistoryListener) => HistoryUnsubscribe; navigate: NavigateFn; } -export type HistoryListenerLocation = WindowLocation & { state?: any }; -export type HistoryListenerParameter = { location: HistoryListenerLocation, action: "PUSH" | "POP" }; -export type HistoryListener = (parameter: HistoryListenerParameter) => void; -export type HistoryUnsubscribe = () => void; - export class Router extends React.Component { } export interface RouterProps {