I'm trying to use ngc to compile angular 2.4.4:
Error: Error encountered resolving symbol values statically. Expression form not supported (position 52:9 in the original .ts file), resolving symbol DEFAULT_APP_STATE in...
It looks like it is complaining about how i'm exporting a constant for @ngrx/store.
I tried changing the constant into an exported function... as well as all of the properties.
Previously:
export const DEFAULT_APP_STATE = { Offline: DEFAULT_APP_OFFLINE_STATE, Initialized: DEFAULT_APP_INITIALIZED_STATE, Console: DEFAULT_CONSOLE_DICTIONARY, Identity: DEFAULT_IDENTITY, HamburgerState: DEFAULT_HAMBURGER_STATE, Customers: DEFAULT_CUSTOMER_STATE, UserMenuVisibility: DEFAULT_USER_MENU_VISIBILITY, StreamViewMultiple: DEFAULT_STREAM_VIEW_MULTIPLE_STATE, StreamViewSingle: DEFAULT_STREAM_VIEW_SINGLE_STATE, Streams: DEFAULT_STREAM_DICTIONARY, Destinations: DEFAULT_DESTINATION_DICTIONARY, DestinationList: DEFAULT_DESTINATION_LIST_STATE, IDestinationTranscodeModal: DEFAULT_DESTINATION_TRANSCODE_MODAL_STATE } as IAppState;
Presently:
export function DEFAULT_APP_STATE() { return { Offline: DEFAULT_APP_OFFLINE_STATE(), Initialized: DEFAULT_APP_INITIALIZED_STATE(), Console: DEFAULT_CONSOLE_DICTIONARY(), Identity: DEFAULT_IDENTITY(), HamburgerState: DEFAULT_HAMBURGER_STATE(), Customers: DEFAULT_CUSTOMER_STATE(), UserMenuVisibility: DEFAULT_USER_MENU_VISIBILITY(), StreamViewMultiple: DEFAULT_STREAM_VIEW_MULTIPLE_STATE(), StreamViewSingle: DEFAULT_STREAM_VIEW_SINGLE_STATE(), Streams: DEFAULT_STREAM_DICTIONARY(), Destinations: DEFAULT_DESTINATION_DICTIONARY(), DestinationList: DEFAULT_DESTINATION_LIST_STATE(), IDestinationTranscodeModal: DEFAULT_DESTINATION_TRANSCODE_MODAL_STATE() } as IAppState; };
I'm using this in my imports[] as such:
... imports: [ ..., StoreModule.provideStore({ Offline: APP_OFFLINE_REDUCER, Initialized: APP_INITIALIZED_REDUCER, Console: CONSOLE_REDUCER, Identity: IDENTITY_REDUCER, Customers: CUSTOMER_REDUCER, Hamburger: HAMBURGER_REDUCER, UserMenuVisibility: USER_MENU_VISIBILITY_REDUCER, StreamViewSingle: STREAM_VIEW_SINGLE_REDUCER, StreamViewMultiple: STREAM_VIEW_MULTIPLE_REDUCER, Streams: STREAM_REDUCER, Destinations: DESTINATION_REDUCER, DestinationList: DESTINATION_LIST_REDUCER, DestinationTranscodeModal: DESTINATION_TRANSCODE_MODAL_REDUCER }, DEFAULT_APP_STATE()), ... ],...
Each reducer has already been changed from a constant lambda declaration to an exported function
old
export const reducer = () => { ...}
new
export function reducer() { ... }
Can anyone make sense of what the ngc compiler is complaining about?