質問編集履歴

1

編集

2019/02/03 07:00

投稿

KentaKatoh
KentaKatoh

スコア14

test CHANGED
File without changes
test CHANGED
@@ -66,4 +66,30 @@
66
66
 
67
67
 
68
68
 
69
+ 例えば以下のようにすればコンパイルエラーにはなりませんが、もう少しactionの形式が変更されることをうまく型で表現できる方法があるのかなと思った次第です。
70
+
71
+
72
+
73
+ ```ts
74
+
75
+ const hogeMiddleware = (store) => (next) => (action) => {
76
+
77
+ let newAction = { ...action }
78
+
79
+ if (isActionOf(hogeRequestSuccessAction, action)) {
80
+
81
+ newAction.payload = newAction.payload.map(hoge => someCalculate(hoge))
82
+
83
+ }
84
+
85
+ next(newAction)
86
+
87
+ }
88
+
89
+ ```
90
+
91
+
92
+
93
+
94
+
69
95
  なにかアイデアをいただけたら嬉しいです。