@@ -59,29 +59,33 @@ const providers = [
59
59
60
60
// if TypeScript could do conditional imports via require,
61
61
// we wouldn't include all those modules in the final bundle ...
62
- import { usePreMiddleware , usePostMiddleware , Middleware } from '@ngrx/store' ;
63
- import { instrumentStore } from '@ngrx/devtools' ;
62
+ import ngRxStore = require ( '@ngrx/store' ) ;
63
+ import ngRxDevtools = require ( '@ngrx/devtools' ) ;
64
64
65
65
if ( process . env . DEVTOOLS ) {
66
+ const ngRxStore = require ( '@ngrx/store' ) ;
67
+ const ngRxDevtools = require ( '@ngrx/devtools' ) ;
66
68
// the following acts just like redux middlewares ...
67
69
// this is the logger middleware
68
- const actionLog : Middleware = action => { // action is the store which acts like an observable
70
+ const actionLog : ngRxStore . Middleware = action => { // action is the store which acts like an observable
69
71
return action . do ( val => { // .do() is only a side-effect, it doesn't affect the value of the stream itself
70
72
console . group ( val . type ) ;
71
73
console . log ( 'will dispatch' , val ) ;
72
74
} ) ;
73
75
} ;
74
- const stateLog : Middleware = state => {
76
+ const stateLog : ngRxStore . Middleware = state => {
75
77
return state . do ( val => {
76
78
console . log ( 'state after dispatch' , val ) ;
77
79
console . groupEnd ( ) ;
78
80
} ) ;
79
81
} ;
80
- providers . push ( usePreMiddleware ( actionLog ) ) ;
81
- providers . push ( usePostMiddleware ( stateLog ) ) ;
82
+ providers . push ( < any > ngRxStore . usePreMiddleware ( actionLog ) ) ;
83
+ providers . push ( < any > ngRxStore . usePostMiddleware ( stateLog ) ) ;
82
84
83
85
// this is the devtools part middleware
84
- providers . push ( instrumentStore ( ) ) ;
86
+ providers . push ( < any > ngRxDevtools . instrumentStore ( ) ) ;
85
87
}
86
88
87
89
bootstrap ( App , providers ) ;
90
+
91
+ /// <reference path="../node_modules/@angular/core/src/di/provider.d.ts" />
0 commit comments