Skip to content

Commit

Permalink
fix: preserve morphs on more piped properties (#1183)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimava authored Oct 25, 2024
1 parent b0636ed commit df78391
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ark/schema/roots/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export abstract class BaseRoot<
branch =>
branch.hasKind("morph") ?
this.$.node("morph", {
in: branch.in,
in: branch.inner.in as never,
morphs: [...branch.morphs, morph]
})
: this.$.node("morph", {
Expand Down
8 changes: 8 additions & 0 deletions ark/type/__tests__/pipe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -912,5 +912,13 @@ Right: { foo: (In: string) => Out<{ [string]: $jsonObject | number | string | $j
foo: "number"
})
attest(T({ foo: "bar" })).snap({ foo: 3 })

const types = scope({
From: { a: ["1", "=>", () => 2] },
Morph: ["From", "=>", e => e],
To: { a: "2" }
}).export()
const U = types.Morph.pipe(e => e, types.To)
attest(U({ a: 1 })).snap({ a: 2 })
})
})

0 comments on commit df78391

Please sign in to comment.