[typescript-angular] Prevent syntax error when using isDateTime=true (#11860)

Fixes a bug where the the `append` method's closing brace was not
generated when using code-generation option `isDateTime=true`.

Fixes #11267.
This commit is contained in:
HexagonSun 2022-03-15 14:02:37 +01:00 committed by GitHub
parent 82b7dee480
commit 834b50233e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 35 additions and 70 deletions

View File

@ -123,8 +123,7 @@ export class {{classname}} {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString(){{^isDateTime}}.substr(0, 10)){{/isDateTime}};
httpParams = httpParams.append(key, (value as Date).toISOString(){{^isDateTime}}.substr(0, 10){{/isDateTime}});
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class DefaultService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -85,8 +85,7 @@ export class PetService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class StoreService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}

View File

@ -70,8 +70,7 @@ export class UserService {
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
} else if (value instanceof Date) {
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString().substr(0, 10));
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10));
} else {
throw Error("key may not be null if value is Date");
}