/** * Union member selection by object-literal keys and predicate targets. * * Selects the best-matching union member for object literal instantiation * and finds union member indices by structural/nominal type matching. */ import type { IrType } from "@tsonic/frontend"; import type { EmitterContext } from "../../types.js"; /** * Select the best union member type to instantiate for an object literal. * * Example: * type Result = Result__0 | Result__1 * return { ok: true, value } // keys: ["ok","value"] * → choose Result__0 * * Matching rules (conservative): * - Only considers union members that are referenceTypes to local interfaces or classes. * - Object literal keys must be a subset of the candidate's property names. * - All *required* (non-optional) candidate properties must be present in the literal. * * Scoring (pick "most specific" deterministically): * 1) Fewer extra properties (candidateProps - literalKeys) * 2) More required properties (prefer tighter required shape) * 3) Fewer total properties * 4) Lexicographic by type name (stable tie-break) */ export declare const selectObjectLiteralUnionMember: (unionType: Extract, literalKeys: readonly string[], context: EmitterContext) => IrType | undefined; export declare const selectUnionMemberForObjectLiteral: (unionType: Extract, literalKeys: readonly string[], context: EmitterContext) => Extract | undefined; export declare const findUnionMemberIndex: (unionType: Extract, target: IrType, context: EmitterContext) => number | undefined; export declare const unionMemberMatchesTarget: (member: IrType, candidate: IrType, context: EmitterContext) => boolean; //# sourceMappingURL=union-predicate-matching.d.ts.map