From 31f0e767af255cdd7681c8f2fc26b0da23173fe8 Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Fri, 18 Nov 2016 19:49:59 -0800 Subject: [PATCH] Add semi-colon, move tsc to posttest --- package.json | 3 ++- test/typings-test.ts | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index b73b51c..462cffe 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "lint": "eslint src/ test/", "prepublish": "npm test && npm run build", "pretest": "npm run lint", - "test": "cross-env NODE_ENV=test nyc mocha && tsc" + "test": "cross-env NODE_ENV=test nyc mocha", + "posttest": "tsc" }, "repository": { "type": "git", diff --git a/test/typings-test.ts b/test/typings-test.ts index 8ce518b..d24e4f4 100644 --- a/test/typings-test.ts +++ b/test/typings-test.ts @@ -1,4 +1,4 @@ -import { FluxStandardAction, isError, isFSA } from '../src' +import { FluxStandardAction, isError, isFSA } from '../src'; interface CustomPayload { a: number @@ -16,53 +16,53 @@ function createCustomAction(payload: CustomPayload): FluxStandardAction): action is FluxStandardAction { - return isFSA(action) && action.type === 'custom' + return isFSA(action) && action.type === 'custom'; } function isCustomAction2(action: FluxStandardAction): action is FluxStandardAction { - return isFSA(action) && action.type === 'custom2' + return isFSA(action) && action.type === 'custom2'; } function isCustomAction3(action: any): action is FluxStandardAction { - return isFSA(action) && action.type === 'custom3' + return isFSA(action) && action.type === 'custom3'; } function reducer(state, action) { if (isFSA(action)) { - let a: number = action.payload.a + let a: number = action.payload.a; } else if (isFSA(action)) { - let a: number = action.payload.a - let b: string = action.meta.b + let a: number = action.payload.a; + let b: string = action.meta.b; } else if (isFSA(action)) { - let meta: string = action.meta + let meta: string = action.meta; } else if (isError(action)) { - let iserr: true = action.error // iserr === true - let err: Error = action.payload + let iserr: true = action.error; // iserr === true + let err: Error = action.payload; } else if (isError(action)) { - let err: MyError = action.payload - let someFieldValue: string = err.someField + let err: MyError = action.payload; + let someFieldValue: string = err.someField; } } function reducer2(state, action) { if (isCustomAction(action)) { - let a: number = action.payload.a + let a: number = action.payload.a; } else if (isCustomAction2(action)) { - let a: number = action.payload.a - let b: string = action.meta.b + let a: number = action.payload.a; + let b: string = action.meta.b; } else if (isCustomAction3(action)) { - let meta: string = action.meta + let meta: string = action.meta; } } -let action = createCustomAction({ a: 123 }) +let action = createCustomAction({ a: 123 });