quicktype-core 23.0.153 → 23.0.154
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.
|
@@ -72,11 +72,11 @@ class TypeScriptEffectSchemaRenderer extends ConvenienceRenderer_1.ConvenienceRe
|
|
|
72
72
|
}
|
|
73
73
|
return ["S.suspend(() => ", name, ")"];
|
|
74
74
|
}
|
|
75
|
-
const match = (0, TypeUtils_1.matchType)(t, _anyType => "S.
|
|
75
|
+
const match = (0, TypeUtils_1.matchType)(t, _anyType => "S.Any", _nullType => "S.Null", _boolType => "S.Boolean", _integerType => "S.Number", _doubleType => "S.Number", _stringType => "S.String", arrayType => ["S.Array(", this.typeMapTypeFor(arrayType.items, false), ")"], _classType => (0, Support_1.panic)("Should already be handled."), _mapType => ["S.Record(S.String, ", this.typeMapTypeFor(_mapType.values, false), ")"], _enumType => (0, Support_1.panic)("Should already be handled."), unionType => {
|
|
76
76
|
const children = Array.from(unionType.getChildren()).map((type) => this.typeMapTypeFor(type, false));
|
|
77
|
-
return ["S.
|
|
77
|
+
return ["S.Union(", ...(0, collection_utils_1.arrayIntercalate)(", ", children), ")"];
|
|
78
78
|
}, _transformedStringType => {
|
|
79
|
-
return "S.
|
|
79
|
+
return "S.String";
|
|
80
80
|
});
|
|
81
81
|
if (required) {
|
|
82
82
|
return [match];
|
|
@@ -98,7 +98,7 @@ class TypeScriptEffectSchemaRenderer extends ConvenienceRenderer_1.ConvenienceRe
|
|
|
98
98
|
this.emittedObjects.add(enumName);
|
|
99
99
|
this.ensureBlankLine();
|
|
100
100
|
this.emitDescription(this.descriptionForType(e));
|
|
101
|
-
this.emitLine("\nexport const ", enumName, " = ", "S.
|
|
101
|
+
this.emitLine("\nexport const ", enumName, " = ", "S.Literal(");
|
|
102
102
|
this.indent(() => this.forEachEnumCase(e, "none", (_, jsonName) => {
|
|
103
103
|
this.emitLine('"', (0, Strings_1.stringEscape)(jsonName), '",');
|
|
104
104
|
}));
|