/** * Semantic union member discovery — alias-preserving. * * This module provides union member analysis for semantic consumers: * guard detection, branch type reasoning, predicate matching. * * The key difference from runtime-unions.ts expansion: * - Authored alias identity is preserved as a single member. * `PathSpec | MiddlewareLike` yields two members, not their expanded contents. * - Explicit `unionType` nodes are flattened (they are structural, not aliases). * - Nullish types are stripped (same as runtime path). * * Runtime carrier construction (buildRuntimeUnionFrame, buildRuntimeUnionLayout) * still uses full expansion via getCanonicalRuntimeUnionMembers. That is correct * for lowering — the carrier needs the expanded member set. * * Semantic consumers must use these helpers so that analysis results are * stable regardless of whether moduleMap / typeAliasIndex are populated. */ import { IrType } from "@tsonic/frontend"; import type { EmitterContext } from "../../types.js"; /** * Discover the semantic union members of a type. * * Flattens explicit `unionType` structure and strips nullish members, * but preserves authored alias references (referenceType nodes) as * single members. This ensures that `PathSpec | MiddlewareLike` yields * exactly two members regardless of what those aliases expand to at * lowering time. * * Returns undefined if the type is not a union or has fewer than 2 * non-nullish members. */ export declare const getSemanticUnionMembers: (type: IrType, context: EmitterContext) => readonly IrType[] | undefined; /** * Find the index of a semantic union member that matches a target type. * * Uses context-aware type equivalence to find which authored member * corresponds to the predicate target. This avoids raw-name comparison and * requires deterministic nominal/CLR/structural identity before matching * reference types. * * Returns the 0-based index, or undefined if no match or multiple matches. */ export declare const findSemanticUnionMemberIndex: (members: readonly IrType[], target: IrType, context: EmitterContext) => number | undefined; //# sourceMappingURL=semantic-union-members.d.ts.map