@@ -5,7 +5,7 @@ interface CustomPayload {
5
5
}
6
6
7
7
interface CustomMetadata {
8
- b : string ;
8
+ b ? : string ;
9
9
}
10
10
11
11
interface MyError extends Error {
@@ -47,10 +47,14 @@ function reducer(state, action) {
47
47
}
48
48
else if ( isFSA < CustomPayload , CustomMetadata > ( action ) ) {
49
49
let a : number = action . payload . a ;
50
- let b : string = action . meta . b ;
50
+ let b : string | undefined ;
51
+
52
+ if ( typeof action . meta !== "undefined" ) {
53
+ b = action . meta . b ;
54
+ }
51
55
}
52
56
else if ( isFSA < void , string > ( action ) ) {
53
- let meta : string = action . meta ;
57
+ let meta : string | undefined = action . meta ;
54
58
}
55
59
else if ( isError ( action ) ) {
56
60
let iserr : true = action . error ; // iserr === true
@@ -68,10 +72,14 @@ function reducer2(state, action) {
68
72
}
69
73
else if ( isCustomAction2 ( action ) ) {
70
74
let a : number = action . payload . a ;
71
- let b : string = action . meta . b ;
75
+ let b : string | undefined ;
76
+
77
+ if ( typeof action . meta !== "undefined" ) {
78
+ b = action . meta . b ;
79
+ }
72
80
}
73
81
else if ( isCustomAction3 ( action ) ) {
74
- let meta : string = action . meta ;
82
+ let meta : string | undefined = action . meta ;
75
83
}
76
84
}
77
85
0 commit comments