angular2-logger: ERROR in [default] \node_modules\angular2-logger\app\core\logger.ts:62:38 Type 'string' is not assignable to type 'Level'.
This problem appeared with angular2-logger 0.3.0 after I updated to Angular 2 rc5. I just updated angular2-logger to its latest 0.4.2 and the problem still shows up.
ERROR in [default] \node_modules\angular2-logger\app\core\logger.ts:62:38 Type 'string' is not assignable to type 'Level'.
Changing the line from:
private _loadLevel = (): Level => localStorage.getItem( this._storeAs );
to
private _loadLevel = (): any=> localStorage.getItem( this._storeAs );
seems to resolve the problem.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 39 (16 by maintainers)
Commits related to this issue
- Starting logger service. Blocked by bug: https://github.com/code-chunks/angular2-logger/issues/65 — committed to michaelpm91/comic-cloud-client by michaelpm91 8 years ago
- Upgraded to Typescript 2.0.2. Fixes #65. — committed to code-chunks/angular2-logger by langley-agm 8 years ago
Ha, edited the best part š Most heated āsearch for truthā Iāve witnessed so far! Thanks guys!
Yea @ascreamingweas ,
In short, it means your build process is compiling this third party library which is an overhead in your build process since the library is already compiled, the fact that you get this error means your build process can be highly improved in order to avoid already compiled third parties (not only this one, but any), getting compiled once again by your PC. If you follow the Quickstart Guide in Angular 2 for either SystemJS or Webpack you wonāt get this error.
If you donāt care about this extra overhead in your projectās build process you can leave it as is, Iāll be commiting a fix for this error soon enough.
@ascreamingweas Yes, this entire thread is about this problem š You can do one of the following directly in the relevant line of the angular2-logger module. These are obviously temporary hacks:
private _loadLevel = (): Level => +localStorage.getItem( this._storeAs );orprivate _loadLevel = (): any => localStorage.getItem( this._storeAs );