Skip to content

Commit 44c90da

Browse files
Removed reliance on downlevelIteration
1 parent c604e02 commit 44c90da

File tree

17 files changed

+234
-31
lines changed

17 files changed

+234
-31
lines changed

modules/openapi-generator/src/main/resources/typescript-axios/common.mustache

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
123123
}
124124

125125
function convertMapsAndSetsToPlain(value: any): any {
126+
if (typeof Set === "undefined") return value;
127+
if (typeof Map === "undefined") return value;
126128
if (typeof value !== "object" || !value) {
127129
return value;
128130
}
129131
if (value instanceof Set) {
130132
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
131133
}
132134
if (value instanceof Map) {
133-
return objectFromEntries([...value.entries()]
134-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
135+
const entries: Array<[string, any]> = [];
136+
value.forEach((value: any, key: any) => {
137+
entries.push([key, convertMapsAndSetsToPlain(value)])
138+
});
139+
return objectFromEntries(entries);
135140
}
136141
if (Array.isArray(value)) {
137142
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/echo_api/typescript-axios/build/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/echo_api/typescript-axios/build/package-lock.json

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/echo_api/typescript-axios/build/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"target": "ES5",
55
"module": "commonjs",
66
"noImplicitAny": true,
7-
"downlevelIteration": true,
87
"outDir": "dist",
98
"rootDir": ".",
109
"lib": [

samples/client/others/typescript-axios/with-separate-models-and-api-inheritance/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/composed-schemas/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/default/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/es6-target/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/test-petstore/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/with-complex-headers/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/with-interfaces/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
131131
}
132132

133133
function convertMapsAndSetsToPlain(value: any): any {
134+
if (typeof Set === "undefined") return value;
135+
if (typeof Map === "undefined") return value;
134136
if (typeof value !== "object" || !value) {
135137
return value;
136138
}
137139
if (value instanceof Set) {
138140
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
139141
}
140142
if (value instanceof Map) {
141-
return objectFromEntries([...value.entries()]
142-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
143+
const entries: Array<[string, any]> = [];
144+
value.forEach((value: any, key: any) => {
145+
entries.push([key, convertMapsAndSetsToPlain(value)])
146+
});
147+
return objectFromEntries(entries);
143148
}
144149
if (Array.isArray(value)) {
145150
return value.map(it => convertMapsAndSetsToPlain(it));

samples/client/petstore/typescript-axios/builds/with-node-imports/common.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,20 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any,
132132
}
133133

134134
function convertMapsAndSetsToPlain(value: any): any {
135+
if (typeof Set === "undefined") return value;
136+
if (typeof Map === "undefined") return value;
135137
if (typeof value !== "object" || !value) {
136138
return value;
137139
}
138140
if (value instanceof Set) {
139141
return Array.from(value).map(item => convertMapsAndSetsToPlain(item));
140142
}
141143
if (value instanceof Map) {
142-
return objectFromEntries([...value.entries()]
143-
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)]));
144+
const entries: Array<[string, any]> = [];
145+
value.forEach((value: any, key: any) => {
146+
entries.push([key, convertMapsAndSetsToPlain(value)])
147+
});
148+
return objectFromEntries(entries);
144149
}
145150
if (Array.isArray(value)) {
146151
return value.map(it => convertMapsAndSetsToPlain(it));

0 commit comments

Comments
 (0)