Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to latest @effect/schema #2574

Merged
merged 2 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/quicktype-core/src/language/TypeScriptEffectSchema.ts
Original file line number Diff line number Diff line change
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