From 085ad4adac7532623d6efeefbf6553ba9c93345b Mon Sep 17 00:00:00 2001 From: aokrushko Date: Thu, 28 Mar 2019 11:45:22 -0400 Subject: [PATCH] Address some of the review comments --- modules/store/spec/action_creator.spec.ts | 2 ++ .../example-app/src/app/auth/actions/auth-api.actions.ts | 8 +++++--- .../src/app/books/actions/collection-page.actions.ts | 5 ++--- .../src/app/books/reducers/books.reducer.spec.ts | 1 - 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/store/spec/action_creator.spec.ts b/modules/store/spec/action_creator.spec.ts index bbba56004a..fb90614c94 100644 --- a/modules/store/spec/action_creator.spec.ts +++ b/modules/store/spec/action_creator.spec.ts @@ -3,6 +3,7 @@ import { expecter } from 'ts-snippet'; describe('Action Creators', () => { let originalTimeout: number; + beforeEach(() => { originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; jasmine.DEFAULT_TIMEOUT_INTERVAL = 2000; @@ -74,6 +75,7 @@ describe('Action Creators', () => { `).toFail(/'bar' does not exist on type/); }); }); + describe('empty', () => { it('should allow empty action', () => { const foo = createAction('FOO'); diff --git a/projects/example-app/src/app/auth/actions/auth-api.actions.ts b/projects/example-app/src/app/auth/actions/auth-api.actions.ts index 06792d2609..ca45fb2bb2 100644 --- a/projects/example-app/src/app/auth/actions/auth-api.actions.ts +++ b/projects/example-app/src/app/auth/actions/auth-api.actions.ts @@ -1,4 +1,4 @@ -import { union, props, createAction } from '@ngrx/store'; +import { props, createAction } from '@ngrx/store'; import { User } from '@example-app/auth/models/user'; export const loginSuccess = createAction( @@ -13,5 +13,7 @@ export const loginFailure = createAction( export const loginRedirect = createAction('[Auth/API] Login Redirect'); -const all = union({ loginSuccess, loginFailure, loginRedirect }); -export type AuthApiActionsUnion = typeof all; +// This is an alternative to union() type export. +export type AuthApiActionsUnion = ReturnType< + typeof loginSuccess | typeof loginFailure | typeof loginRedirect +>; diff --git a/projects/example-app/src/app/books/actions/collection-page.actions.ts b/projects/example-app/src/app/books/actions/collection-page.actions.ts index d7f001452c..7bfd6174ca 100644 --- a/projects/example-app/src/app/books/actions/collection-page.actions.ts +++ b/projects/example-app/src/app/books/actions/collection-page.actions.ts @@ -1,9 +1,8 @@ -import { createAction, union } from '@ngrx/store'; +import { createAction } from '@ngrx/store'; /** * Load Collection Action */ export const loadCollection = createAction('[Collection Page] Load Collection'); -const all = union({ loadCollection }); -export type CollectionPageActionsUnion = typeof all; +export type CollectionPageActionsUnion = ReturnType; diff --git a/projects/example-app/src/app/books/reducers/books.reducer.spec.ts b/projects/example-app/src/app/books/reducers/books.reducer.spec.ts index 3956c4cee1..fc6429e840 100644 --- a/projects/example-app/src/app/books/reducers/books.reducer.spec.ts +++ b/projects/example-app/src/app/books/reducers/books.reducer.spec.ts @@ -1,5 +1,4 @@ import { reducer } from '@example-app/books/reducers/books.reducer'; -import { union } from '@ngrx/store'; import * as fromBooks from '@example-app/books/reducers/books.reducer'; import { BooksApiActions,