The second type parameter G embeds the specific InterfaceGuard type
for use by GuardedMethods when extracting guard-inferred method
signatures.
G is carried in two slots:
__getInterfaceGuard__?: () => InterfaceGuard | undefined — the
runtime accessor, typed with the wideInterfaceGuard return so
it stays compatible across different specific Gs. A function
return is invariant under assignment, so embedding the specific G
here would make Guarded<M, G1> and Guarded<M, G2> mutually
incompatible even when M is structurally identical.
__interfaceGuard__?(g?: G): void — a phantom method (not a
field) carrying the specific G at the type level. Method
shorthand syntax gives g's type bivariant treatment under
assignment, so Guarded<M, G1> and Guarded<M, G2> are
structurally compatible even when their Gs differ. Optional, so
no runtime cost. GuardedMethods<E> reads from this phantom.
When no guard is provided (unguarded overloads), G defaults to a
generic InterfaceGuard keyed by M.
The second type parameter
Gembeds the specific InterfaceGuard type for use by GuardedMethods when extracting guard-inferred method signatures.Gis carried in two slots:__getInterfaceGuard__?: () => InterfaceGuard | undefined— the runtime accessor, typed with the wideInterfaceGuardreturn so it stays compatible across different specificGs. A function return is invariant under assignment, so embedding the specificGhere would makeGuarded<M, G1>andGuarded<M, G2>mutually incompatible even whenMis structurally identical.__interfaceGuard__?(g?: G): void— a phantom method (not a field) carrying the specificGat the type level. Method shorthand syntax givesg's type bivariant treatment under assignment, soGuarded<M, G1>andGuarded<M, G2>are structurally compatible even when theirGs differ. Optional, so no runtime cost.GuardedMethods<E>reads from this phantom.When no guard is provided (unguarded overloads),
Gdefaults to a generic InterfaceGuard keyed byM.