Effect CommunityEC
Effect Community5mo ago
2 replies
noah

Error when using `Schema.partialWith`/`Schema.partial` with `Model.FieldOption`

There seems to be a bug when combining Schema.partialWith/Schema.partial and Model.FieldOption:

export class Test extends Model.Class<Test>('Test')({
  test: Model.FieldOption(Schema.Number),
}) {}

const TO = Schema.partialWith(Test.json, { extact: true })
// or 
const TO = Schema.partial(Test.json)


Results in the following error:
2055 |     case "Transformation":
2056 |       {
2057 |         if (isTypeLiteralTransformation(ast.transformation) && ast.transformation.propertySignatureTransformatio
ns.every(isRenamingPropertySignatureTransformation)) {
2058 |           return new Transformation(partial(ast.from, options), partial(ast.to, options), ast.transformation);
2059 |         }
2060 |         throw new Error(errors_.getASTUnsupportedSchemaErrorMessage(ast));
                     ^
error: Unsupported schema

This only happens with Model.FieldOption and non of the other model combinators from my testing
Was this page helpful?