quicktype-core 23.0.150 → 23.0.152

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.
@@ -46,6 +46,7 @@ export declare class KotlinRenderer extends ConvenienceRenderer {
46
46
  protected kotlinType(t: Type, withIssues?: boolean, noOptional?: boolean): Sourcelike;
47
47
  protected emitUsageHeader(): void;
48
48
  protected emitHeader(): void;
49
+ protected emitTopLevelPrimitive(t: PrimitiveType, name: Name): void;
49
50
  protected emitTopLevelArray(t: ArrayType, name: Name): void;
50
51
  protected emitTopLevelMap(t: MapType, name: Name): void;
51
52
  protected emitEmptyClassDefinition(c: ClassType, className: Name): void;
@@ -209,6 +209,10 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
209
209
  this.emitLine("package ", this._kotlinOptions.packageName);
210
210
  this.ensureBlankLine();
211
211
  }
212
+ emitTopLevelPrimitive(t, name) {
213
+ const elementType = this.kotlinType(t);
214
+ this.emitLine(["typealias ", name, " = ", elementType, ""]);
215
+ }
212
216
  emitTopLevelArray(t, name) {
213
217
  const elementType = this.kotlinType(t.items);
214
218
  this.emitLine(["typealias ", name, " = ArrayList<", elementType, ">"]);
@@ -327,6 +331,9 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
327
331
  else if (t instanceof Type_1.MapType) {
328
332
  this.emitTopLevelMap(t, name);
329
333
  }
334
+ else if (t.isPrimitive()) {
335
+ this.emitTopLevelPrimitive(t, name);
336
+ }
330
337
  });
331
338
  this.forEachNamedType("leading-and-interposing", (c, n) => this.emitClassDefinition(c, n), (e, n) => this.emitEnumDefinition(e, n), (u, n) => this.emitUnionDefinition(u, n));
332
339
  }
@@ -64,6 +64,7 @@ export declare class TypeScriptRenderer extends TypeScriptFlowBaseRenderer {
64
64
  protected emitUsageImportComment(): void;
65
65
  protected emitEnum(e: EnumType, enumName: Name): void;
66
66
  protected emitClassBlock(c: ClassType, className: Name): void;
67
+ protected emitSourceStructure(): void;
67
68
  }
68
69
  export declare class FlowTargetLanguage extends TypeScriptFlowBaseTargetLanguage {
69
70
  constructor();
@@ -153,6 +153,15 @@ class TypeScriptFlowBaseRenderer extends JavaScript_1.JavaScriptRenderer {
153
153
  this.emitLine("export type ", unionName, " = ", children.source, ";");
154
154
  }
155
155
  emitTypes() {
156
+ // emit primitive top levels
157
+ this.forEachTopLevel("none", (t, name) => {
158
+ if (!t.isPrimitive()) {
159
+ return;
160
+ }
161
+ this.ensureBlankLine();
162
+ this.emitDescription(this.descriptionForType(t));
163
+ this.emitLine("type ", name, " = ", this.sourceFor(t).source, ";");
164
+ });
156
165
  this.forEachNamedType("leading-and-interposing", (c, n) => this.emitClass(c, n), (e, n) => this.emitEnum(e, n), (u, n) => this.emitUnion(u, n));
157
166
  }
158
167
  emitUsageComments() {
@@ -258,6 +267,9 @@ class TypeScriptRenderer extends TypeScriptFlowBaseRenderer {
258
267
  this.emitClassBlockBody(c);
259
268
  });
260
269
  }
270
+ emitSourceStructure() {
271
+ super.emitSourceStructure();
272
+ }
261
273
  }
262
274
  exports.TypeScriptRenderer = TypeScriptRenderer;
263
275
  class FlowTargetLanguage extends TypeScriptFlowBaseTargetLanguage {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.0.150",
3
+ "version": "23.0.152",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",