The constraint uses AnyMethodGuard (all type parameters set to
any) rather than the bare MethodGuard (which defaults its parameters
to their constraint, e.g. RetGuard extends SyncValueGuard = SyncValueGuard). Without this, TS contextually types inline expressions
like M.call().returns(M.promise()) against SyncValueGuard, which
causes MatcherOf<'promise', any>'s Payload type parameter to drift
from any to a non-canonical unknown form (void | RawGuardPayload | null) — breaking downstream TypeFromPattern inference whose unknown extends Payload check doesn't recognize that form as unknown.
General overload for interface guards.
The constraint uses AnyMethodGuard (all type parameters set to
any) rather than the bareMethodGuard(which defaults its parameters to their constraint, e.g.RetGuard extends SyncValueGuard = SyncValueGuard). Without this, TS contextually types inline expressions likeM.call().returns(M.promise())againstSyncValueGuard, which causesMatcherOf<'promise', any>'sPayloadtype parameter to drift fromanyto a non-canonical unknown form (void | RawGuardPayload | null) — breaking downstreamTypeFromPatterninference whoseunknown extends Payloadcheck doesn't recognize that form asunknown.