@@ -312,11 +312,11 @@ export interface MemoryHistory<S extends State = State> extends History<S> {
312
312
index : number ;
313
313
}
314
314
315
- const readOnly : < T extends unknown > ( obj : T ) => T = __DEV__
316
- ? obj => Object . freeze ( obj )
317
- : obj => obj ;
315
+ const readOnly : < T > ( obj : T ) => Readonly < T > = __DEV__
316
+ ? ( obj ) => Object . freeze ( obj )
317
+ : ( obj ) => obj ;
318
318
319
- function warning ( cond : boolean , message : string ) {
319
+ function warning ( cond : any , message : string ) {
320
320
if ( ! cond ) {
321
321
// eslint-disable-next-line no-console
322
322
if ( typeof console !== 'undefined' ) console . warn ( message ) ;
@@ -545,7 +545,7 @@ export function createBrowserHistory(
545
545
window . addEventListener ( BeforeUnloadEventType , promptBeforeUnload ) ;
546
546
}
547
547
548
- return function ( ) {
548
+ return function ( ) {
549
549
unblock ( ) ;
550
550
551
551
// Remove the beforeunload listener so the document may
@@ -582,9 +582,11 @@ export function createHashHistory(
582
582
let globalHistory = window . history ;
583
583
584
584
function getIndexAndLocation ( ) : [ number , Location ] {
585
- let { pathname = '/' , search = '' , hash = '' } = parsePath (
586
- window . location . hash . substr ( 1 )
587
- ) ;
585
+ let {
586
+ pathname = '/' ,
587
+ search = '' ,
588
+ hash = ''
589
+ } = parsePath ( window . location . hash . substr ( 1 ) ) ;
588
590
let state = globalHistory . state || { } ;
589
591
return [
590
592
state . idx ,
@@ -804,7 +806,7 @@ export function createHashHistory(
804
806
window . addEventListener ( BeforeUnloadEventType , promptBeforeUnload ) ;
805
807
}
806
808
807
- return function ( ) {
809
+ return function ( ) {
808
810
unblock ( ) ;
809
811
810
812
// Remove the beforeunload listener so the document may
@@ -845,7 +847,7 @@ export function createMemoryHistory(
845
847
options : MemoryHistoryOptions = { }
846
848
) : MemoryHistory {
847
849
let { initialEntries = [ '/' ] , initialIndex } = options ;
848
- let entries : Location [ ] = initialEntries . map ( entry => {
850
+ let entries : Location [ ] = initialEntries . map ( ( entry ) => {
849
851
let location = readOnly < Location > ( {
850
852
pathname : '/' ,
851
853
search : '' ,
@@ -1016,20 +1018,18 @@ function createEvents<F extends Function>(): Events<F> {
1016
1018
} ,
1017
1019
push ( fn : F ) {
1018
1020
handlers . push ( fn ) ;
1019
- return function ( ) {
1020
- handlers = handlers . filter ( handler => handler !== fn ) ;
1021
+ return function ( ) {
1022
+ handlers = handlers . filter ( ( handler ) => handler !== fn ) ;
1021
1023
} ;
1022
1024
} ,
1023
1025
call ( arg ) {
1024
- handlers . forEach ( fn => fn && fn ( arg ) ) ;
1026
+ handlers . forEach ( ( fn ) => fn && fn ( arg ) ) ;
1025
1027
}
1026
1028
} ;
1027
1029
}
1028
1030
1029
1031
function createKey ( ) {
1030
- return Math . random ( )
1031
- . toString ( 36 )
1032
- . substr ( 2 , 8 ) ;
1032
+ return Math . random ( ) . toString ( 36 ) . substr ( 2 , 8 ) ;
1033
1033
}
1034
1034
1035
1035
/**
0 commit comments