Defining Circular Dependencies with Effect Schema

How can I define circular dependencies with Effect Schema?

import * as S from '@effect/schema/Schema'

const Supplier = S.struct({
  id: S.string,
  name: S.string,
  url: S.string,
  location: S.string,
  products: S.suspend(() => S.array(Product)),
})

const Product = S.struct({
  id: S.string,
  name: S.string,
  url: S.string,
  supplier: S.suspend(() => Supplier),
})
image.png
Was this page helpful?