quicktype-core 21.0.5 → 21.0.7

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.
@@ -16,6 +16,7 @@ export declare const tsFlowOptions: {
16
16
  nicePropertyNames: BooleanOption;
17
17
  declareUnions: BooleanOption;
18
18
  preferUnions: BooleanOption;
19
+ preferTypes: BooleanOption;
19
20
  };
20
21
  export declare abstract class TypeScriptFlowBaseTargetLanguage extends JavaScriptTargetLanguage {
21
22
  protected getOptions(): Option<any>[];
@@ -14,7 +14,8 @@ exports.tsFlowOptions = Object.assign({}, JavaScript_1.javaScriptOptions, {
14
14
  justTypes: new RendererOptions_1.BooleanOption("just-types", "Interfaces only", false),
15
15
  nicePropertyNames: new RendererOptions_1.BooleanOption("nice-property-names", "Transform property names to be JavaScripty", false),
16
16
  declareUnions: new RendererOptions_1.BooleanOption("explicit-unions", "Explicitly name unions", false),
17
- preferUnions: new RendererOptions_1.BooleanOption("prefer-unions", "Use union type instead of enum", false)
17
+ preferUnions: new RendererOptions_1.BooleanOption("prefer-unions", "Use union type instead of enum", false),
18
+ preferTypes: new RendererOptions_1.BooleanOption("prefer-types", "Use types instead of interfaces", false)
18
19
  });
19
20
  const tsFlowTypeAnnotations = {
20
21
  any: ": any",
@@ -35,7 +36,8 @@ class TypeScriptFlowBaseTargetLanguage extends JavaScript_1.JavaScriptTargetLang
35
36
  exports.tsFlowOptions.acronymStyle,
36
37
  exports.tsFlowOptions.converters,
37
38
  exports.tsFlowOptions.rawType,
38
- exports.tsFlowOptions.preferUnions
39
+ exports.tsFlowOptions.preferUnions,
40
+ exports.tsFlowOptions.preferTypes
39
41
  ];
40
42
  }
41
43
  get supportsOptionalClassProperties() {
@@ -234,7 +236,9 @@ class TypeScriptRenderer extends TypeScriptFlowBaseRenderer {
234
236
  }
235
237
  }
236
238
  emitClassBlock(c, className) {
237
- this.emitBlock(["export interface ", className, " "], "", () => {
239
+ this.emitBlock(this._tsFlowOptions.preferTypes
240
+ ? ["export type ", className, " = "]
241
+ : ["export interface ", className, " "], "", () => {
238
242
  this.emitClassBlockBody(c);
239
243
  });
240
244
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "21.0.5",
3
+ "version": "21.0.7",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",