diff --git a/src/main/java/io/swagger/codegen/v3/generators/typescript/TypeScriptAngularClientCodegen.java b/src/main/java/io/swagger/codegen/v3/generators/typescript/TypeScriptAngularClientCodegen.java index 6a84edc802..03ed083d69 100644 --- a/src/main/java/io/swagger/codegen/v3/generators/typescript/TypeScriptAngularClientCodegen.java +++ b/src/main/java/io/swagger/codegen/v3/generators/typescript/TypeScriptAngularClientCodegen.java @@ -154,6 +154,11 @@ public void processOpts() { if (!ngVersion.atLeast("4.3.0")) { supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts")); } + + // Version after Angular 10 require ModuleWithProviders to be generic. Compatible from version 7. + if (ngVersion.atLeast("7.0.0")) { + additionalProperties.put("genericModuleWithProviders", true); + } // for Angular 2 AOT support we will use good-old ngc, // Angular Package format wasn't invented at this time and building was much more easier diff --git a/src/main/resources/handlebars/typescript-angular/api.module.mustache b/src/main/resources/handlebars/typescript-angular/api.module.mustache index 06dad036e6..2953814b3c 100644 --- a/src/main/resources/handlebars/typescript-angular/api.module.mustache +++ b/src/main/resources/handlebars/typescript-angular/api.module.mustache @@ -18,7 +18,7 @@ import { {{classname}} } from './{{importPath}}'; {{/hasMore}}{{/apis}}{{/apiInfo}} ] }) export class ApiModule { - public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { + public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders{{#genericModuleWithProviders}}{{/genericModuleWithProviders}} { return { ngModule: ApiModule, providers: [ { provide: Configuration, useFactory: configurationFactory } ]