Skip to content

Commit

Permalink
[typescript-angular] strict type checking (#218)
Browse files Browse the repository at this point in the history
* strict type checking

* strict type checking

* generate samples for angular-typescript
  • Loading branch information
macjohnny authored and wing328 committed Jun 11, 2018
1 parent 2392a09 commit 0a479f7
Show file tree
Hide file tree
Showing 37 changed files with 222 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class {{classname}} {
{{/produces}}
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
{{^useHttpClient}}
headers.set('Accept', httpHeaderAcceptSelected);
{{/useHttpClient}}
Expand All @@ -243,7 +243,7 @@ export class {{classname}} {
];
{{#bodyParam}}
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
{{^useHttpClient}}
headers.set('Content-Type', httpContentTypeSelected);
{{/useHttpClient}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Configuration {
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
if (contentTypes.length === 0) {
return undefined;
}

Expand All @@ -51,7 +51,7 @@ export class Configuration {
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
if (accepts.length === 0) {
return undefined;
}

Expand All @@ -74,6 +74,6 @@ export class Configuration {
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.0.1-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class PetService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand All @@ -227,7 +227,7 @@ export class PetService {
'application/xml'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down Expand Up @@ -274,7 +274,7 @@ export class PetService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -327,7 +327,7 @@ export class PetService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -381,7 +381,7 @@ export class PetService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -427,7 +427,7 @@ export class PetService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -473,7 +473,7 @@ export class PetService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand All @@ -483,7 +483,7 @@ export class PetService {
'application/xml'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down Expand Up @@ -528,7 +528,7 @@ export class PetService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -601,7 +601,7 @@ export class PetService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class StoreService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -178,7 +178,7 @@ export class StoreService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -218,7 +218,7 @@ export class StoreService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -258,15 +258,15 @@ export class StoreService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ export class UserService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down Expand Up @@ -247,15 +247,15 @@ export class UserService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down Expand Up @@ -290,15 +290,15 @@ export class UserService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down Expand Up @@ -333,7 +333,7 @@ export class UserService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -373,7 +373,7 @@ export class UserService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -425,7 +425,7 @@ export class UserService {
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -460,7 +460,7 @@ export class UserService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

Expand Down Expand Up @@ -502,15 +502,15 @@ export class UserService {
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected != undefined) {
if (httpHeaderAcceptSelected !== undefined) {
headers.set('Accept', httpHeaderAcceptSelected);
}

// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected != undefined) {
if (httpContentTypeSelected !== undefined) {
headers.set('Content-Type', httpContentTypeSelected);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Configuration {
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length == 0) {
if (contentTypes.length === 0) {
return undefined;
}

Expand All @@ -51,7 +51,7 @@ export class Configuration {
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length == 0) {
if (accepts.length === 0) {
return undefined;
}

Expand All @@ -74,6 +74,6 @@ export class Configuration {
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime != null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.0.1-SNAPSHOT
Loading

0 comments on commit 0a479f7

Please sign in to comment.