import { KeyOfMethods, Methods, StrictMethodsGuard } from '../utils/type-utils'; export interface FnsWireGuard { /** * @internal * Covariance hack: * never use this variable. * don't remove space at the start */ ' fns-wire': StrictMethodsGuard; // Covariance hack } export interface FnsWire extends FnsWireGuard { fn: >(name: K, value: Fns[K]) => () => void; fns: Methods; } export function isFnsWire( wire: unknown, ): wire is FnsWire { return !!(wire && (wire as any)[' fns-wire']); } export function createFnsWireGuard(): FnsWireGuard { return { ' fns-wire': true as any }; } export type WireFns> = W extends FnsWire ? Fns : never;