/** * Fixtures for GENERIC components whose props are typed THROUGH the component's own type * parameter. This is the `Badge` shape, where `type?: T` and * `color?: BadgeColor` (= `…Map[T]`) were silently dropped: the analyzer had no branch * for type parameters or the constraint-dependent types (indexed-access, conditional) * that hinge on them, so they fell through to `misc`. Resolving each to its base * constraint turns it into a string-literal union → an `enum` ("options") field. * * Each export below isolates one way a generic can carry an enum, plus the unconstrained * case that must degrade gracefully (no enum, no crash). */ type Size = 'sm' | 'md' | 'lg'; type BadgeKind = 'pill-color' | 'color' | 'modern'; type ColorByKind = { 'pill-color': 'gray' | 'brand' | 'error'; color: 'gray' | 'brand' | 'error'; modern: 'gray'; }; /** * Bare type parameter (`kind?: T`) + indexed-access (`color?: ColorByKind[T]`), alongside * a plain union control (`size`). Mirrors `Badge` most directly. */ export declare function GenericBadge(props: { /** Bare type parameter — constraint is the BadgeKind union. */ kind?: T; /** Plain union (control — always worked). */ size?: Size; /** Indexed-access into a map, keyed by the type parameter. */ color?: ColorByKind[T]; }): { /** Bare type parameter — constraint is the BadgeKind union. */ kind?: T; /** Plain union (control — always worked). */ size?: Size; /** Indexed-access into a map, keyed by the type parameter. */ color?: ColorByKind[T]; }; /** Conditional type that depends on the type parameter. */ export declare function ConditionalBadge(props: { dir?: T; placement?: T extends 'in' ? 'top' | 'bottom' : 'left' | 'right'; }): { dir?: T; placement?: T extends "in" ? "top" | "bottom" : "left" | "right"; }; /** Multiple, independently-constrained type parameters. */ export declare function MultiGenericBadge(props: { a?: A; b?: B; }): { a?: A; b?: B; }; declare const badgeTypes: { readonly pillColor: "pill-color"; readonly badgeColor: "color"; readonly badgeModern: "modern"; }; type BadgeTypesFromConst = (typeof badgeTypes)[keyof typeof badgeTypes]; /** * Type parameter whose constraint is derived from a `const` object's values — the exact * `BadgeTypes = (typeof badgeTypes)[keyof typeof badgeTypes]` shape used in some component libraries. */ export declare function ConstDerivedBadge(props: { type?: T; }): { type?: T; }; /** * Unconstrained type parameter — there is no enum to recover, so this must degrade * gracefully (NOT become a union/enum, and never throw). */ export declare function UnconstrainedGeneric(props: { value?: T; }): { value?: T; }; export {}; //# sourceMappingURL=generic-props.d.ts.map