@genroc/eval-node 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.js +4 -2
- package/import.ts +7 -2
- package/package.json +1 -1
package/dist/import.js
CHANGED
|
@@ -90,15 +90,17 @@ function objectType(s, used) {
|
|
|
90
90
|
const doc = typeof sub.description === "string"
|
|
91
91
|
? ` /** ${sub.description} */\n`
|
|
92
92
|
: "";
|
|
93
|
-
lines.push(`${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${tsType(sub, used)};`);
|
|
93
|
+
lines.push(`${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${nest(tsType(sub, used))};`);
|
|
94
94
|
}
|
|
95
95
|
if (s.additionalProperties && typeof s.additionalProperties === "object") {
|
|
96
|
-
lines.push(` [key: string]: ${tsType(s.additionalProperties, used)};`);
|
|
96
|
+
lines.push(` [key: string]: ${nest(tsType(s.additionalProperties, used))};`);
|
|
97
97
|
}
|
|
98
98
|
if (lines.length === 0)
|
|
99
99
|
return "Record<string, unknown>";
|
|
100
100
|
return `{\n${lines.join("\n")}\n}`;
|
|
101
101
|
}
|
|
102
|
+
/** Every line but the first, which is already placed by the property that opens it. */
|
|
103
|
+
const nest = (t) => t.replace(/\n/g, "\n ");
|
|
102
104
|
function union(parts) {
|
|
103
105
|
const seen = [...new Set(parts)];
|
|
104
106
|
return seen.length === 0 ? "unknown" : seen.join(" | ");
|
package/import.ts
CHANGED
|
@@ -137,16 +137,21 @@ function objectType(s: Schema, used: Set<string>): string {
|
|
|
137
137
|
? ` /** ${sub.description} */\n`
|
|
138
138
|
: "";
|
|
139
139
|
lines.push(
|
|
140
|
-
`${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${tsType(sub, used)};`,
|
|
140
|
+
`${doc} ${propKey(key)}${required.has(key) ? "" : "?"}: ${nest(tsType(sub, used))};`,
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
if (s.additionalProperties && typeof s.additionalProperties === "object") {
|
|
144
|
-
lines.push(
|
|
144
|
+
lines.push(
|
|
145
|
+
` [key: string]: ${nest(tsType(s.additionalProperties, used))};`,
|
|
146
|
+
);
|
|
145
147
|
}
|
|
146
148
|
if (lines.length === 0) return "Record<string, unknown>";
|
|
147
149
|
return `{\n${lines.join("\n")}\n}`;
|
|
148
150
|
}
|
|
149
151
|
|
|
152
|
+
/** Every line but the first, which is already placed by the property that opens it. */
|
|
153
|
+
const nest = (t: string) => t.replace(/\n/g, "\n ");
|
|
154
|
+
|
|
150
155
|
function union(parts: string[]): string {
|
|
151
156
|
const seen = [...new Set(parts)];
|
|
152
157
|
return seen.length === 0 ? "unknown" : seen.join(" | ");
|