Endo
    Preparing search index...

    Function makeExo

    • Create a singleton exo object whose methods are type-checked against the InterfaceGuard at compile time.

      When a typed InterfaceGuard is provided (built with M.call(...).returns(...)), the methods parameter is constrained to match the guard's inferred method signatures at compile time. The return type is derived from the concrete methods argument (not the guard), so narrower implementations are preserved.

      const FooI = M.interface('Foo', {
      bar: M.call(M.string()).returns(M.nat()),
      });
      const foo = makeExo('Foo', FooI, {
      bar(name) { // name: string — inferred from guard
      return 0n; // must return bigint — enforced by guard
      },
      });

      Type Parameters

      • G extends InterfaceGuard
      • M extends {
            [key: string]: ((...args: []) => Promise<any>) | ((...args: []) => any);
            [key: number]: ((...args: []) => Promise<any>) | ((...args: []) => any);
            [key: symbol]: ((...args: []) => Promise<any>) | ((...args: []) => any);
        } & Methods

      Parameters

      Returns Guarded<M, G>

    • Create a singleton exo object whose methods are type-checked against the InterfaceGuard at compile time.

      When a typed InterfaceGuard is provided (built with M.call(...).returns(...)), the methods parameter is constrained to match the guard's inferred method signatures at compile time. The return type is derived from the concrete methods argument (not the guard), so narrower implementations are preserved.

      const FooI = M.interface('Foo', {
      bar: M.call(M.string()).returns(M.nat()),
      });
      const foo = makeExo('Foo', FooI, {
      bar(name) { // name: string — inferred from guard
      return 0n; // must return bigint — enforced by guard
      },
      });

      Type Parameters

      Parameters

      Returns Guarded<M>