question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not working with Angular 2.0 Release

See original GitHub issue

Setting this in modules config {provide: Logger}

package.json is “angular2-logger”: “^0.5.0”,

getting the following `(23,11): error TS2345: Argument of type ‘{ imports: (typeof BrowserModule | ModuleWithProviders)[]; declarations: (typeof App | typeof Thu…’ is not assignable to parameter of type ‘NgModule’. Types of property ‘providers’ are incompatible. Type ‘({ [x: number]: undefined; provide: typeof LocationStrategy; useClass: typeof HashLocationStrateg…’ is not assignable to type ‘(TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]’. Type ‘{ [x: number]: undefined; provide: typeof LocationStrategy; useClass: typeof HashLocationStrategy…’ is not assignable to type ‘TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[]’. Type ‘{ [x: number]: undefined; provide: typeof Logger; }’ is not assignable to type ‘TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[]’. Type ‘{ [x: number]: undefined; provide: typeof Logger; }’ is not assignable to type ‘any[]’. Property ‘length’ is missing in type ‘{ [x: number]: undefined; provide: typeof Logger; }’.

ERROR in ./~/angular2-logger/app/core/level.ts Module parse failed: /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/angular2-logger/app/core/level.ts Unexpected token (9:7) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (9:7) at Parser.pp$4.raise (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp.expect (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:597:28) at Parser.pp$1.parseExportSpecifiers (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1215:10) at Parser.pp$1.parseExport (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1186:30) at Parser.pp$1.parseStatement (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:719:71) at Parser.pp$1.parseTopLevel (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock.<anonymous> (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose as oncomplete @ ./~/angular2-logger/core.js 5:9-36

ERROR in ./~/angular2-logger/app/core/logger.ts Module parse failed: /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/angular2-logger/app/core/logger.ts Unexpected token (18:9) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (18:9) at Parser.pp$4.raise (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp.expect (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:597:28) at Parser.pp$3.parseMethod (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:2071:10) at Parser.pp$1.parseClassMethod (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1137:25) at Parser.pp$1.parseClass (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1118:14) at Parser.pp$1.parseStatement (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:697:19) at Parser.pp$1.parseExport (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1181:31) at Parser.pp$1.parseStatement (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:719:71) at Parser.pp$1.parseTopLevel (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock.<anonymous> (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose as oncomplete @ ./~/angular2-logger/core.js 6:9-37

ERROR in ./~/angular2-logger/app/core/providers.ts Module parse failed: /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/angular2-logger/app/core/providers.ts Unexpected token (10:33) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (10:33) at Parser.pp$4.raise (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:2221:15) at Parser.pp.unexpected (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:603:10) at Parser.pp$1.parseVar (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1036:16) at Parser.pp$1.parseVarStatement (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:917:10) at Parser.pp$1.parseStatement (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:706:19) at Parser.pp$1.parseExport (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:1181:31) at Parser.pp$1.parseStatement (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:719:71) at Parser.pp$1.parseTopLevel (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:638:25) at Parser.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:516:17) at Object.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/acorn/dist/acorn.js:3098:39) at Parser.parse (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack/lib/Parser.js:902:15) at DependenciesBlock.<anonymous> (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack/lib/NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10) at nextLoader (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25) at /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5 at Storage.finished (/Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16) at /Users/jasontesser/dev/git/dotCMS-Desktop/node_modules/graceful-fs/graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose as oncomplete @ ./~/angular2-logger/core.js 7:9-40`

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jtessercommented, Oct 3, 2016

humm. I guess I had to remove the exclude in the loader.

Now the error is as follows

ERROR in ./src/app/app.module.ts (24,11): error TS2345: Argument of type '{ imports: (typeof BrowserModule | ModuleWithProviders)[]; declarations: (typeof App | typeof Thu...' is not assignable to parameter of type 'NgModule'. Types of property 'providers' are incompatible. Type '({ [x: number]: undefined; provide: typeof LocationStrategy; useClass: typeof HashLocationStrateg...' is not assignable to type '(TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[])[]'. Type '{ [x: number]: undefined; provide: typeof LocationStrategy; useClass: typeof HashLocationStrategy...' is not assignable to type 'TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[]'. Type '{ [x: number]: undefined; provide: typeof Logger; }' is not assignable to type 'TypeProvider | ValueProvider | ClassProvider | ExistingProvider | FactoryProvider | any[]'. Type '{ [x: number]: undefined; provide: typeof Logger; }' is not assignable to type 'any[]'. Property 'find' is missing in type '{ [x: number]: undefined; provide: typeof Logger; }'.

0reactions
Benyaminrmbcommented, Jun 13, 2018

this is my error

ERROR in src/app/app.module.ts(141,41): error TS2345: Argument of type '{ declarations: (typeof TestComponent | typeof AppComponent | typeof SnackBarComponent | typeof Q...' is not assignable to parameter of type 'NgModule'.
  Types of property 'providers' are incompatible.
    Type '(typeof ToolService | typeof AuthService | typeof QuoteService | typeof AdminService | typeof Aut...' is not assignable to type 'Provider[]'.
      Type 'typeof ToolService | typeof AuthService | typeof QuoteService | typeof AdminService | typeof Auth...' is not assignable to type 'Provider'.
        Type '{ provide: InjectionToken<HttpInterceptor[]>; BrowserXhr: typeof BrowserXhr; SWIPER_CONFIG: Injec...' is not assignable to type 'Provider'.
          Object literal may only specify known properties, and 'BrowserXhr' does not exist in type 'Provider'.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular versioning and releases
Angular version numbers indicate the level of changes that are introduced by the release. This use of semantic versioning helps you understand the...
Read more >
Angular Version List & History – Angular 2,4,5,6,7,8 - Guru99
Angular version 8 was released on May 28, 2019. This update enhance loading for all application codes, Web worker's Dynamic imports for lazy ......
Read more >
Angular 2.0 Release: Pipes and Directives are not properties ...
Angular 2.0 Release : Pipes and Directives are not properties of @Component anymore - Stack Overflow. Stack Overflow for Teams – Start collaborating...
Read more >
Releases · angular/angular - GitHub
2 weeks ago ... malformedUriErrorHandler - This was found to not be used anywhere ... update packages/language-service/build.sh script to work with ...
Read more >
Angular (web framework) - Wikipedia
Angular (also referred to as "Angular 2+") is a TypeScript-based, free and open-source web application framework led by the Angular Team at Google...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found