Generic type 'BaseService<T>' requires 1 type argument(s)


I have used a generic provider in my code, which is injected in my components:

 export class BaseService<T> {
 getAll(): Observable<T[]> { }

It works well when I run ionic liveserver but if I run ionic build android the ngc compiler throws the error:

ngc: Error: Error at C:/dev/ecdt-mobile/.tmp/app/app.module.ngfactory.ts:177:20: 
Generic type 'BaseService<T>' requires 1 type argument(s).        

I’ve checked the app.module.ngfactory.ts file and the error is here:

   constructor(parent:import47.Injector) {

import46.BaseService is underline in red in my IDE.

What is wrong here ?

I guess the generated code should be something like:


Is this a angular issue or ionic issue ?


I have created a repro with angular only and the compilation does not give any error. What is strange though is that the generated code is the same, with the same code being underlined in my IDE.

Is Ionic using a different version of ngc, which is preventing the code from compiling ?

This is the command line I’ve used for my angular2 repro (without ionic):

"node_modules/.bin/ngc" -p tsconfig-aot.json

and my tsconfig-aot.json file is:

  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "types": []

  "files": [

  "angularCompilerOptions": {
   "genDir": "aot",
   "skipMetadataEmit" : true


As a follow-up, is there a way to skip AOT when running ionic build ?


for anyone interested… Explanations here:

and to skip AOT, just build with the --dev option in package.json:

“build”: “ionic-app-scripts build --dev”,