Skip to content

typescript-jquery: Update to work with Typescript strict mode #3969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/windows/typescript-jquery-with-npm.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ If Not Exist %executable% (
)

REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -c bin\typescript-petstore-npm.json -g typescript-jquery -o samples\client\petstore\typescript-jquery\npm
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -c bin\typescript-jquery-petstore-npm.json -g typescript-jquery -o samples\client\petstore\typescript-jquery\npm

java %JAVA_OPTS% -jar %executable% %ags%
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class {{classname}} {
protected basePath = '{{{basePath}}}';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class {{classname}} {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
apiKey: string | undefined;
username: string | undefined;
password: string | undefined;
accessToken: string | (() => string) | undefined;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class PetApi {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class StoreApi {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class UserApi {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
apiKey: string | undefined;
username: string | undefined;
password: string | undefined;
accessToken: string | (() => string) | undefined;
}
26 changes: 0 additions & 26 deletions samples/client/petstore/typescript-jquery/default/model/Amount.ts

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions samples/client/petstore/typescript-jquery/npm/api/PetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class PetApi {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/typescript-jquery/npm/api/StoreApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class StoreApi {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/typescript-jquery/npm/api/UserApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();

constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
Expand All @@ -37,7 +37,7 @@ export class UserApi {
}
}

private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
apiKey: string | undefined;
username: string | undefined;
password: string | undefined;
accessToken: string | (() => string) | undefined;
}

This file was deleted.

This file was deleted.