Endo
    Preparing search index...

    Type Alias CastedPattern<T>

    CastedPattern: Pattern & { "Symbol(castedType)"?: T }

    A pattern carrying an unchecked static type assertion. The runtime pattern still validates the structural shape it always did; the T parameter is a developer claim that values matched by this pattern inhabit T — typically narrower than what the structural shape can recover (e.g., a discriminated union, a branded type, or a template literal).

    Like a TypeScript as cast, CastedPattern<T> is trusted by the type system but unverifiable at runtime. If the pattern matches a value that doesn't actually satisfy T, downstream code may misbehave with no runtime error.

    TypeFromPattern<CastedPattern<T>> resolves to T, bypassing the normal structural inference.

    Type Parameters

    • T
    // structural pattern with a discriminated-union static claim
    const AmountShape = harden({
    brand: BrandShape,
    value: AmountValueShape,
    });
    // The structural inference would yield the cross-product
    // `{ brand: Brand, value: NatValue | SetValue | ... }`. The cast
    // unifies brand and value through the discriminated union.
    export const AmountPattern =
    ({brand: BrandShape, value: AmountValueShape});