Skip to content

Commit 78ce303

Browse files
authored
Merge pull request #730 from bezineb5/ts-angular-ModuleWithProviders-fx
Templatized ModuleWithProviders in typescript-angular
2 parents f3710d3 + 6c08748 commit 78ce303

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/io/swagger/codegen/v3/generators/typescript/TypeScriptAngularClientCodegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ public void processOpts() {
154154
if (!ngVersion.atLeast("4.3.0")) {
155155
supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts"));
156156
}
157+
158+
// Version after Angular 10 require ModuleWithProviders to be generic. Compatible from version 7.
159+
if (ngVersion.atLeast("7.0.0")) {
160+
additionalProperties.put("genericModuleWithProviders", true);
161+
}
157162

158163
// for Angular 2 AOT support we will use good-old ngc,
159164
// Angular Package format wasn't invented at this time and building was much more easier

src/main/resources/handlebars/typescript-angular/api.module.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { {{classname}} } from './{{importPath}}';
1818
{{/hasMore}}{{/apis}}{{/apiInfo}} ]
1919
})
2020
export class ApiModule {
21-
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
21+
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders{{#genericModuleWithProviders}}<ApiModule>{{/genericModuleWithProviders}} {
2222
return {
2323
ngModule: ApiModule,
2424
providers: [ { provide: Configuration, useFactory: configurationFactory } ]

0 commit comments

Comments
 (0)