Creating Compatible Recursive Schemas with Branded Types in Effect Typescript

how can i make branded types compatible with recursive schemas?
type DataType = IntType | ListType;
type IntType = bigint & Brand.Brand<"Integer">;
type ListType = readonly DataType[];

const DataType = Schema.Union(
  Schema.BigInt.pipe(Schema.brand("Integer")),
  Schema.Array(Schema.suspend((): Schema.Schema<DataType> => DataType))
);
Was this page helpful?