import { type OpaqueCell, toSchema } from "commonfabric"; // FIXTURE: intersection-source-types // Verifies: intersections retain source type distinctions through schema // generation. Opaque cells and `void` have different intersection behavior; // nested and named branded primitives retain their primitive constraints, // including when distinct unions fold to equal schemas. // Expected: each call matches the checker-based generator, including `false` // for disjoint folded unions in either order. type Brand = string & { topic: unknown }; type Folded = (string & { a: 1 }) | (number & { b: 2 }); type A = { a: 1 }; type B = { b: 2 }; type C = { c: 3 }; type D = { d: 4 }; type OpaqueCompatible = any & OpaqueCell & string & unknown; export const validOpaque: OpaqueCompatible = 123; export const opaqueCompatible = toSchema< any & OpaqueCell & string & unknown >(); export const opaqueImpossible = toSchema< any & OpaqueCell & undefined & unknown >(); export const voidCompatible = toSchema(); export const voidImpossible = toSchema(); export const distinctSources = toSchema< any & OpaqueCell & void & undefined & unknown >(); export const unionSources = toSchema< any & (OpaqueCell | void) & string & unknown >(); export const nestedImpossible = toSchema< any & (string & { topic: unknown }) & number >(); export const namedImpossible = toSchema(); export const nestedWithoutAny = toSchema< (string & { topic: unknown }) & number >(); export const nestedCompatible = toSchema< any & (string & { topic: unknown }) & string >(); export const reducedInnerAny = toSchema<(any & null) & string & unknown>(); export const distributedBrand = toSchema<(Brand | number) & boolean & unknown>(); export const unionBesideAny = toSchema< any & (Brand | number) & boolean & unknown >(); export const foldedUnionBesideAny = toSchema(); export const foldedUnion = toSchema(); export const disjointFoldedUnions = toSchema< ((("a" & A) | ("b" & B)) & unknown) & (((1 & C) | (2 & D)) & unknown) >(); export const reversedDisjointFoldedUnions = toSchema< (((1 & C) | (2 & D)) & unknown) & ((("a" & A) | ("b" & B)) & unknown) >();