Skip to content

Commit 9331df7

Browse files
FallenRiteMonkwing328
authored andcommitted
Minor Angular type improvements (#1843)
Update api.service.mustache update samples
1 parent 9ccf872 commit 9331df7

File tree

54 files changed

+289
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+289
-289
lines changed

modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class {{classname}} {
221221
{{/isOAuth}}
222222
{{/authMethods}}
223223
// to determine the Accept header
224-
let httpHeaderAccepts: string[] = [
224+
const httpHeaderAccepts: string[] = [
225225
{{#produces}}
226226
'{{{mediaType}}}'{{#hasMore}},{{/hasMore}}
227227
{{/produces}}

modules/openapi-generator/src/main/resources/typescript-angular/configuration.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class Configuration {
3636
return undefined;
3737
}
3838

39-
let type = contentTypes.find(x => this.isJsonMime(x));
39+
const type = contentTypes.find((x: string) => this.isJsonMime(x));
4040
if (type === undefined) {
4141
return contentTypes[0];
4242
}
@@ -55,7 +55,7 @@ export class Configuration {
5555
return undefined;
5656
}
5757

58-
let type = accepts.find(x => this.isJsonMime(x));
58+
const type = accepts.find((x: string) => this.isJsonMime(x));
5959
if (type === undefined) {
6060
return accepts[0];
6161
}

samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class PetService {
215215
}
216216

217217
// to determine the Accept header
218-
let httpHeaderAccepts: string[] = [
218+
const httpHeaderAccepts: string[] = [
219219
];
220220
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
221221
if (httpHeaderAcceptSelected !== undefined) {
@@ -272,7 +272,7 @@ export class PetService {
272272
}
273273

274274
// to determine the Accept header
275-
let httpHeaderAccepts: string[] = [
275+
const httpHeaderAccepts: string[] = [
276276
];
277277
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
278278
if (httpHeaderAcceptSelected !== undefined) {
@@ -323,7 +323,7 @@ export class PetService {
323323
}
324324

325325
// to determine the Accept header
326-
let httpHeaderAccepts: string[] = [
326+
const httpHeaderAccepts: string[] = [
327327
'application/xml',
328328
'application/json'
329329
];
@@ -377,7 +377,7 @@ export class PetService {
377377
}
378378

379379
// to determine the Accept header
380-
let httpHeaderAccepts: string[] = [
380+
const httpHeaderAccepts: string[] = [
381381
'application/xml',
382382
'application/json'
383383
];
@@ -423,7 +423,7 @@ export class PetService {
423423
}
424424

425425
// to determine the Accept header
426-
let httpHeaderAccepts: string[] = [
426+
const httpHeaderAccepts: string[] = [
427427
'application/xml',
428428
'application/json'
429429
];
@@ -471,7 +471,7 @@ export class PetService {
471471
}
472472

473473
// to determine the Accept header
474-
let httpHeaderAccepts: string[] = [
474+
const httpHeaderAccepts: string[] = [
475475
];
476476
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
477477
if (httpHeaderAcceptSelected !== undefined) {
@@ -526,7 +526,7 @@ export class PetService {
526526
}
527527

528528
// to determine the Accept header
529-
let httpHeaderAccepts: string[] = [
529+
const httpHeaderAccepts: string[] = [
530530
];
531531
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
532532
if (httpHeaderAcceptSelected !== undefined) {
@@ -598,7 +598,7 @@ export class PetService {
598598
}
599599

600600
// to determine the Accept header
601-
let httpHeaderAccepts: string[] = [
601+
const httpHeaderAccepts: string[] = [
602602
'application/json'
603603
];
604604
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);

samples/client/petstore/typescript-angular-v2/default/api/store.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class StoreService {
136136
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
137137

138138
// to determine the Accept header
139-
let httpHeaderAccepts: string[] = [
139+
const httpHeaderAccepts: string[] = [
140140
];
141141
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
142142
if (httpHeaderAcceptSelected !== undefined) {
@@ -175,7 +175,7 @@ export class StoreService {
175175
}
176176

177177
// to determine the Accept header
178-
let httpHeaderAccepts: string[] = [
178+
const httpHeaderAccepts: string[] = [
179179
'application/json'
180180
];
181181
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
@@ -214,7 +214,7 @@ export class StoreService {
214214
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
215215

216216
// to determine the Accept header
217-
let httpHeaderAccepts: string[] = [
217+
const httpHeaderAccepts: string[] = [
218218
'application/xml',
219219
'application/json'
220220
];
@@ -254,7 +254,7 @@ export class StoreService {
254254
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
255255

256256
// to determine the Accept header
257-
let httpHeaderAccepts: string[] = [
257+
const httpHeaderAccepts: string[] = [
258258
'application/xml',
259259
'application/json'
260260
];

samples/client/petstore/typescript-angular-v2/default/api/user.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class UserService {
202202
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
203203

204204
// to determine the Accept header
205-
let httpHeaderAccepts: string[] = [
205+
const httpHeaderAccepts: string[] = [
206206
];
207207
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
208208
if (httpHeaderAcceptSelected !== undefined) {
@@ -245,7 +245,7 @@ export class UserService {
245245
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
246246

247247
// to determine the Accept header
248-
let httpHeaderAccepts: string[] = [
248+
const httpHeaderAccepts: string[] = [
249249
];
250250
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
251251
if (httpHeaderAcceptSelected !== undefined) {
@@ -288,7 +288,7 @@ export class UserService {
288288
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
289289

290290
// to determine the Accept header
291-
let httpHeaderAccepts: string[] = [
291+
const httpHeaderAccepts: string[] = [
292292
];
293293
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
294294
if (httpHeaderAcceptSelected !== undefined) {
@@ -331,7 +331,7 @@ export class UserService {
331331
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
332332

333333
// to determine the Accept header
334-
let httpHeaderAccepts: string[] = [
334+
const httpHeaderAccepts: string[] = [
335335
];
336336
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
337337
if (httpHeaderAcceptSelected !== undefined) {
@@ -369,7 +369,7 @@ export class UserService {
369369
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
370370

371371
// to determine the Accept header
372-
let httpHeaderAccepts: string[] = [
372+
const httpHeaderAccepts: string[] = [
373373
'application/xml',
374374
'application/json'
375375
];
@@ -421,7 +421,7 @@ export class UserService {
421421
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
422422

423423
// to determine the Accept header
424-
let httpHeaderAccepts: string[] = [
424+
const httpHeaderAccepts: string[] = [
425425
'application/xml',
426426
'application/json'
427427
];
@@ -458,7 +458,7 @@ export class UserService {
458458
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
459459

460460
// to determine the Accept header
461-
let httpHeaderAccepts: string[] = [
461+
const httpHeaderAccepts: string[] = [
462462
];
463463
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
464464
if (httpHeaderAcceptSelected !== undefined) {
@@ -500,7 +500,7 @@ export class UserService {
500500
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
501501

502502
// to determine the Accept header
503-
let httpHeaderAccepts: string[] = [
503+
const httpHeaderAccepts: string[] = [
504504
];
505505
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
506506
if (httpHeaderAcceptSelected !== undefined) {

samples/client/petstore/typescript-angular-v2/default/configuration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class Configuration {
3636
return undefined;
3737
}
3838

39-
let type = contentTypes.find(x => this.isJsonMime(x));
39+
const type = contentTypes.find((x: string) => this.isJsonMime(x));
4040
if (type === undefined) {
4141
return contentTypes[0];
4242
}
@@ -55,7 +55,7 @@ export class Configuration {
5555
return undefined;
5656
}
5757

58-
let type = accepts.find(x => this.isJsonMime(x));
58+
const type = accepts.find((x: string) => this.isJsonMime(x));
5959
if (type === undefined) {
6060
return accepts[0];
6161
}

samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class PetService {
215215
}
216216

217217
// to determine the Accept header
218-
let httpHeaderAccepts: string[] = [
218+
const httpHeaderAccepts: string[] = [
219219
];
220220
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
221221
if (httpHeaderAcceptSelected !== undefined) {
@@ -272,7 +272,7 @@ export class PetService {
272272
}
273273

274274
// to determine the Accept header
275-
let httpHeaderAccepts: string[] = [
275+
const httpHeaderAccepts: string[] = [
276276
];
277277
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
278278
if (httpHeaderAcceptSelected !== undefined) {
@@ -323,7 +323,7 @@ export class PetService {
323323
}
324324

325325
// to determine the Accept header
326-
let httpHeaderAccepts: string[] = [
326+
const httpHeaderAccepts: string[] = [
327327
'application/xml',
328328
'application/json'
329329
];
@@ -377,7 +377,7 @@ export class PetService {
377377
}
378378

379379
// to determine the Accept header
380-
let httpHeaderAccepts: string[] = [
380+
const httpHeaderAccepts: string[] = [
381381
'application/xml',
382382
'application/json'
383383
];
@@ -423,7 +423,7 @@ export class PetService {
423423
}
424424

425425
// to determine the Accept header
426-
let httpHeaderAccepts: string[] = [
426+
const httpHeaderAccepts: string[] = [
427427
'application/xml',
428428
'application/json'
429429
];
@@ -471,7 +471,7 @@ export class PetService {
471471
}
472472

473473
// to determine the Accept header
474-
let httpHeaderAccepts: string[] = [
474+
const httpHeaderAccepts: string[] = [
475475
];
476476
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
477477
if (httpHeaderAcceptSelected !== undefined) {
@@ -526,7 +526,7 @@ export class PetService {
526526
}
527527

528528
// to determine the Accept header
529-
let httpHeaderAccepts: string[] = [
529+
const httpHeaderAccepts: string[] = [
530530
];
531531
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
532532
if (httpHeaderAcceptSelected !== undefined) {
@@ -598,7 +598,7 @@ export class PetService {
598598
}
599599

600600
// to determine the Accept header
601-
let httpHeaderAccepts: string[] = [
601+
const httpHeaderAccepts: string[] = [
602602
'application/json'
603603
];
604604
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);

samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class StoreService {
136136
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
137137

138138
// to determine the Accept header
139-
let httpHeaderAccepts: string[] = [
139+
const httpHeaderAccepts: string[] = [
140140
];
141141
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
142142
if (httpHeaderAcceptSelected !== undefined) {
@@ -175,7 +175,7 @@ export class StoreService {
175175
}
176176

177177
// to determine the Accept header
178-
let httpHeaderAccepts: string[] = [
178+
const httpHeaderAccepts: string[] = [
179179
'application/json'
180180
];
181181
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
@@ -214,7 +214,7 @@ export class StoreService {
214214
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
215215

216216
// to determine the Accept header
217-
let httpHeaderAccepts: string[] = [
217+
const httpHeaderAccepts: string[] = [
218218
'application/xml',
219219
'application/json'
220220
];
@@ -254,7 +254,7 @@ export class StoreService {
254254
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
255255

256256
// to determine the Accept header
257-
let httpHeaderAccepts: string[] = [
257+
const httpHeaderAccepts: string[] = [
258258
'application/xml',
259259
'application/json'
260260
];

0 commit comments

Comments
 (0)