Skip to content

Commit

Permalink
sync runtime extraction with type extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Aug 15, 2024
1 parent 542409f commit 8d74cd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/experimental/src/VariantSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ export const extract: {
const fields: Record<string, any> = {}
for (const key of Object.keys(self[TypeId])) {
const value = self[TypeId][key]
if (Schema.TypeId in value) {
fields[key] = value
if (TypeId in value) {
fields[key] = extract(value, variant)
} else if (FieldTypeId in value) {
if (variant in value.schemas) {
fields[key] = value.schemas[variant]
}
} else {
fields[key] = extract(value, variant)
fields[key] = value
}
}
return Schema.Struct(fields) as any
Expand Down

0 comments on commit 8d74cd3

Please sign in to comment.