I'm also running into the famous error "Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol ", when running i18n. I've already done a lot of research, and I'm not using a lambda function. It happens when I add the following import statement to my base module:
export const mapsConfig = new LazyMapsAPILoaderConfig();
mapsConfig.apiKey = 'xyz';
// ... below is in import list
BingMapsModule.forRoot(config),
I'm using ng2-bingmaps, which I've contributed to as well: https://github.com/youjustgo/ng2-bingmaps
The weird thing is that it does not matter what the JS code is in ng2-bingmaps. If I remove all .js files, I still get the same error! So, it must be something in the ng2-bingmaps core.d.ts which looks like this:
/**
* ng2-bingmaps - Angular 2 components for Bing Maps
* @version v0.2.0
* @link https://github.com/youjustgo/ng2-bingmaps
* @license MIT
*/
import { ModuleWithProviders } from '@angular/core';
import { LazyMapsAPILoaderConfig } from './services/maps-api-loader/lazy-maps-api-loader';
export * from './directives';
export * from './services';
export declare const NG2_BINGMAPS_PROVIDERS: any[];
/**
* The ng2-bing-maps core module. Contains all Directives/Services/Pipes
* of the core module. Please use `BingMapsModule.forRoot(config)` in your app module.
*
* @experimental
*/
export declare class BingMapsModule {
static forRoot(config: LazyMapsAPILoaderConfig): ModuleWithProviders;
}
When I just import BingMapsModule (without the forRoot), it works.
I have checked all providers in ng2-bingmaps, and none of them have lambda functions inside the decorators.
My base module definition:
@NgModule({
imports: [
// browser module, required to load in browser
BrowserModule,
// routing
RouterModule.forRoot(routes),
// angular forms
FormsModule,
// ng2-bingmaps
BingMapsModule.forRoot(mapsConfig),
// ng-bootstrap
NgbModule,
// http
HttpModule,
// Angulartics2
// Angulartics2Module.forRoot(),
// our custom modules for certain parts of our app
CreateBookingModule,
CommonModule
],
declarations: [
// all our components
],
bootstrap: [ ClientApp ],
providers: [
// our services
]
})
"Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol "
Though I've never seen this error, it sounds like it's referring to this
export const mapsConfig = new LazyMapsAPILoaderConfig();
If the mapsConfig
is in the same file as the module you're using it in, there shouldn't be a need to export it. I imagine removing the export
should solve the error.
Another thing, you probably don't need to create an instance of the config. You could just use an object literal because of TypeScript's structural type system
BingMapsModule.forRoot({
apiKey: 'xyz'
})
Generally with "config" objects, this is how you will see it used anyway.
In the end I've resolved it, thanks the @peeskillet for the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With