Skip to content

Commit

Permalink
update to latest @effect/schema (#2574)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Apr 28, 2024
1 parent 49e9e03 commit 19bba82
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 523 deletions.
22 changes: 11 additions & 11 deletions packages/quicktype-core/src/language/TypeScriptEffectSchema.ts
Expand Up @@ -121,24 +121,24 @@ export class TypeScriptEffectSchemaRenderer extends ConvenienceRenderer {

const match = matchType<Sourcelike>(
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), ")"],
_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 => panic("Should already be handled."),
_mapType => ["S.record(S.string, ", this.typeMapTypeFor(_mapType.values, false), ")"],
_mapType => ["S.Record(S.String, ", this.typeMapTypeFor(_mapType.values, false), ")"],
_enumType => panic("Should already be handled."),
unionType => {
const children = Array.from(unionType.getChildren()).map((type: Type) =>
this.typeMapTypeFor(type, false)
);
return ["S.union(", ...arrayIntercalate(", ", children), ")"];
return ["S.Union(", ...arrayIntercalate(", ", children), ")"];
},
_transformedStringType => {
return "S.string";
return "S.String";
}
);

Expand All @@ -165,7 +165,7 @@ export class TypeScriptEffectSchemaRenderer extends ConvenienceRenderer {
this.emittedObjects.add(enumName);
this.ensureBlankLine();
this.emitDescription(this.descriptionForType(e));
this.emitLine("\nexport const ", enumName, " = ", "S.literal(");
this.emitLine("\nexport const ", enumName, " = ", "S.Literal(");
this.indent(() =>
this.forEachEnumCase(e, "none", (_, jsonName) => {
this.emitLine('"', stringEscape(jsonName), '",');
Expand Down

0 comments on commit 19bba82

Please sign in to comment.