Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23c37fb

Browse files
committed
prettier + internal type fixes
1 parentf042c81 commit23c37fb

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

‎packages/history/index.ts‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,11 @@ export interface MemoryHistory<S extends State = State> extends History<S> {
312312
index:number;
313313
}
314314

315-
constreadOnly:<Textendsunknown>(obj:T)=>T=__DEV__
316-
?obj=>Object.freeze(obj)
317-
:obj=>obj;
315+
constreadOnly:<T>(obj:T)=>Readonly<T>=__DEV__
316+
?(obj)=>Object.freeze(obj)
317+
:(obj)=>obj;
318318

319-
functionwarning(cond:boolean,message:string){
319+
functionwarning(cond:any,message:string){
320320
if(!cond){
321321
// eslint-disable-next-line no-console
322322
if(typeofconsole!=='undefined')console.warn(message);
@@ -545,7 +545,7 @@ export function createBrowserHistory(
545545
window.addEventListener(BeforeUnloadEventType,promptBeforeUnload);
546546
}
547547

548-
returnfunction(){
548+
returnfunction(){
549549
unblock();
550550

551551
// Remove the beforeunload listener so the document may
@@ -582,9 +582,11 @@ export function createHashHistory(
582582
letglobalHistory=window.history;
583583

584584
functiongetIndexAndLocation():[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));
588590
letstate=globalHistory.state||{};
589591
return[
590592
state.idx,
@@ -804,7 +806,7 @@ export function createHashHistory(
804806
window.addEventListener(BeforeUnloadEventType,promptBeforeUnload);
805807
}
806808

807-
returnfunction(){
809+
returnfunction(){
808810
unblock();
809811

810812
// Remove the beforeunload listener so the document may
@@ -845,7 +847,7 @@ export function createMemoryHistory(
845847
options:MemoryHistoryOptions={}
846848
):MemoryHistory{
847849
let{ initialEntries=['/'], initialIndex}=options;
848-
letentries:Location[]=initialEntries.map(entry=>{
850+
letentries:Location[]=initialEntries.map((entry)=>{
849851
letlocation=readOnly<Location>({
850852
pathname:'/',
851853
search:'',
@@ -1016,20 +1018,18 @@ function createEvents<F extends Function>(): Events<F> {
10161018
},
10171019
push(fn:F){
10181020
handlers.push(fn);
1019-
returnfunction(){
1020-
handlers=handlers.filter(handler=>handler!==fn);
1021+
returnfunction(){
1022+
handlers=handlers.filter((handler)=>handler!==fn);
10211023
};
10221024
},
10231025
call(arg){
1024-
handlers.forEach(fn=>fn&&fn(arg));
1026+
handlers.forEach((fn)=>fn&&fn(arg));
10251027
}
10261028
};
10271029
}
10281030

10291031
functioncreateKey(){
1030-
returnMath.random()
1031-
.toString(36)
1032-
.substr(2,8);
1032+
returnMath.random().toString(36).substr(2,8);
10331033
}
10341034

10351035
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp