Skip to content

Commit

Permalink
Update typings-test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wub authored Feb 12, 2017
1 parent fb671f5 commit 58840bc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions test/typings-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface CustomPayload {
}

interface CustomMetadata {
b: string;
b?: string;
}

interface MyError extends Error {
Expand Down Expand Up @@ -47,10 +47,14 @@ function reducer(state, action) {
}
else if (isFSA<CustomPayload, CustomMetadata>(action)) {
let a: number = action.payload.a;
let b: string = action.meta.b;
let b: string | undefined;

if (typeof action.meta !== "undefined") {
b = action.meta.b;
}
}
else if (isFSA<void, string>(action)) {
let meta: string = action.meta;
let meta: string | undefined = action.meta;
}
else if (isError(action)) {
let iserr: true = action.error; // iserr === true
Expand All @@ -68,10 +72,14 @@ function reducer2(state, action) {
}
else if (isCustomAction2(action)) {
let a: number = action.payload.a;
let b: string = action.meta.b;
let b: string | undefined;

if (typeof action.meta !== "undefined") {
b = action.meta.b;
}
}
else if (isCustomAction3(action)) {
let meta: string = action.meta;
let meta: string | undefined = action.meta;
}
}

Expand Down

0 comments on commit 58840bc

Please sign in to comment.