import { environment } from '../../environments/environment';
import { Headers } from '@angular/http';
@Injectable()
export class ProjectsService {
private _wpBase = environment.wpBase;
ng build --prod gives me an error :
ERROR in src/app/projects/projects.service.ts(11,33): error TS2339: Property 'wpBase' does not exist on type '{ production: boolean; }'.
How can I fix this? The app works fine, I'm trying to implement Angular Universal using this guide: https://github.com/angular/angular-cli/wiki/stories-universal-rendering
You probably forgot to set the wpBase property in environment.prod.ts...
Check both your environment.ts and environment.prod.ts and see if you have set the wpBase correctly.
Quick fix is to type the environment as any:
@Injectable()
export class ProjectsService {
private _wpBase = (environment as any).wpBase;
}
Proper fix would be to add type definition for your environment object.
interface AppEnv {
production: boolean;
wpBase: // whatever is the correct type
}
export const environment: AppEnv = {
production: false,
wpBase: // whatever is the value
};
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