Effect CommunityEC
Effect Community2y ago
15 replies
dan_watford

using Schema.partial with Structs having property signatures

Hello,

Is Schema.partial expected to work on Structs that use property signatures?

import { Schema as S } from "@effect/schema";
import { Effect } from "effect";

const TestType = S.Struct({
  aaa: S.String,
  bbb: S.propertySignature(S.String).pipe(S.fromKey("ZZZ")),
});

const PartialTestType = S.partial(TestType);

test("partial decoding", () => {
  const input = { aaa: "aaaval", ZZZ: "zzzval" };
  const expected = { aaa: "aaaval", bbb: "zzzval" };

  const actual = Effect.runSync(S.decode(TestType)(input));
  expect(actual).toStrictEqual(expected);
});



Running the above tests results in:
 FAIL  tests/model/schema-partial.test.ts
  ● Test suite failed to run

    Partial: cannot handle transformations

       8 | });
       9 |
> 10 | const PartialTestType = S.partial(TestType);
Was this page helpful?