While working on my Angular 1 app in typescript, I faced an issue when importing angular using the following syntax:
import * as angular from 'angular';
Instead of importing angular from angular
, it was being imported from angular-mocks
. This caused a failure in my ILogService implementation.
ERROR in ./app/shared/Logger.factory.ts (38,7): error TS2420: Class 'Logger' incorrectly implements interface 'ILogService'. Types of property 'debug' are incompatible. Type '(...argument: any[]) => void' is not assignable to type 'ILogCall'.
Even while trying to navigate to 'angular'
from vscode
, it redirected me to the angular-mocks angular definition instead of the actual angular library. This navigation should point to angular and not the mock library...
Any suggestions on how to resolve this problem?
EDIT
Here is the custom service implementation that is causing the typescript compilation error mentioned above:
class Logger implements ng.ILogService {
info(message:string) { //some custom logic in info method}
}
angular.service('logger', Logger)