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

Commitb37779b

Browse files
committed
Drops unneeded namespace (fixes#19)
1 parentd3dd046 commitb37779b

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

‎src/actions/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import*asreduxfrom'redux'
22

33
import{api}from'../api'
4-
import{Store}from'../reducers/index'
4+
import*asstatefrom'../reducers/index'
55

66
typeQ<T>={request:T}
77
typeS<T>={response:T}
@@ -60,7 +60,7 @@ const _loadCount: ApiActionGroup<null, { value: number }> = {
6060
typeapiFunc<Q,S>=(q:Q)=>Promise<S>
6161

6262
functionapiActionGroupFactory<Q,S>(x:ApiActionGroup<Q,S>,go:apiFunc<Q,S>){
63-
return(request:Q)=>(dispatch:redux.Dispatch<Store.All>)=>{
63+
return(request:Q)=>(dispatch:redux.Dispatch<state.All>)=>{
6464
dispatch(x.request(request))
6565
go(request)
6666
.then((response)=>dispatch(x.success(response,request)))

‎src/components/counter.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
saveCount,
99
}from'../actions'
1010

11-
import{Store}from'../reducers'
11+
import*asstatefrom'../reducers'
1212

1313
importloadablefrom'../decorators/loadable'
1414

@@ -28,14 +28,14 @@ type ConnectedDispatch = {
2828
load:()=>void
2929
}
3030

31-
constmapStateToProps=(state:Store.All,ownProps:OwnProps):ConnectedState=>({
31+
constmapStateToProps=(state:state.All,ownProps:OwnProps):ConnectedState=>({
3232
counter:state.counter,
3333
isSaving:state.isSaving,
3434
isLoading:state.isLoading,
3535
error:state.error,
3636
})
3737

38-
constmapDispatchToProps=(dispatch:redux.Dispatch<Store.All>):ConnectedDispatch=>({
38+
constmapDispatchToProps=(dispatch:redux.Dispatch<state.All>):ConnectedDispatch=>({
3939
increment:(n:number)=>
4040
dispatch(incrementCounter(n)),
4141
load:()=>

‎src/index.tsx‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ import * as redux from 'redux'
44
import{Provider}from'react-redux'
55
importthunkfrom'redux-thunk'
66

7-
import{
8-
reducers,
9-
Store,
10-
}from'./reducers'
7+
import*asstatefrom'./reducers'
118

129
import{Counter}from'./components/counter'
1310

14-
letstore:redux.Store<Store.All>=redux.createStore(
15-
reducers,
16-
{}asStore.All,
11+
letstore:redux.Store<state.All>=redux.createStore(
12+
state.reducers,
13+
{}asstate.All,
1714
redux.applyMiddleware(thunk),
1815
)
1916

‎src/reducers/index.ts‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ import { combineReducers } from 'redux'
22

33
import{Action}from'../actions'
44

5-
exportnamespaceStore{
5+
exporttypeCounter={value:number}
66

7-
exporttypeCounter={value:number}
8-
9-
exporttypeAll={
10-
counter:Counter,
11-
isSaving:boolean,
12-
isLoading:boolean,
13-
error:string,
14-
}
7+
exporttypeAll={
8+
counter:Counter,
9+
isSaving:boolean,
10+
isLoading:boolean,
11+
error:string,
1512
}
1613

1714
functionisSaving(state:boolean=false,action:Action):boolean{
@@ -51,11 +48,11 @@ function error (state: string = '', action: Action): string {
5148
}
5249
}
5350

54-
constinitialState:Store.Counter={
51+
constinitialState:Counter={
5552
value:0,
5653
}
5754

58-
functioncounter(state:Store.Counter=initialState,action:Action):Store.Counter{
55+
functioncounter(state:Counter=initialState,action:Action):Counter{
5956
switch(action.type){
6057
case'INCREMENT_COUNTER':
6158
const{ delta}=action
@@ -72,7 +69,7 @@ function counter (state: Store.Counter = initialState, action: Action): Store.Co
7269
}
7370
}
7471

75-
exportconstreducers=combineReducers<Store.All>({
72+
exportconstreducers=combineReducers<All>({
7673
counter,
7774
isSaving,
7875
isLoading,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp