0

recently I upgraded to:

  • angular-cli 6.0.7
  • angular 6.0.3

I have generated a new project and wanted to use the new Injectable decorator. When decorating a class:

  @Injectable({
      providedIn: 'root'
   })
   export class SomeService {
       constructor() { }
   }

I get following compile error:

Argument type {providedIn: "root"} is not assignable to parameter type {providedIn: Type | "root" | null} & InjectableProvider Checks TypeScript called function parameters , return values , assigned expressions to be of correct type.

When I write the class like:

 @Injectable
 export class SomeService {
    constructor() { }
 }

I get a runtime error with the same message.

Any ideas?

Vikas
  • 11,859
  • 7
  • 45
  • 69
WorstCoderEver
  • 414
  • 1
  • 5
  • 15

0 Answers0