title: Typescript definition for type (proxy) with dynamically called functions
body: <p>I have an Interface for my type that has a variety of built in functions. Since the underlying implementation uses a Proxy, the functions are not actually functions but rather objects in an array that are keyed to functions.</p>
  
  <p>Imagine it like this:</p>
  
  <pre><code>interface Interface {
    defaultFunction(): Interface;
    otherDefaultFunction(): Interface;
    unrelatedOtherFunction(): boolean;
    someProperty: string;
  }
  
  const functions = [
    defaultFunction: (arg: string) =&gt; true;
    otherDefaultFunction: (arg: number) =&gt; true;
  ]
  
  const customFunctions = [
    someFunctionWithAName: (arg: boolean, arg2: string) =&gt; true;
  ]
  </code></pre>
  
  <p>The names of custom functions can not be known at compile time. They might all have differing argument amounts and types. Through the proxy the functions are executed and their result is handled behind the scenes, then the Proxy is passed back as the return. The Proxy essentially adheres to this pseudo Interface. The issue is once you add a custom function, it has no types and therefore an error occurs.</p>
  
  <blockquote>
    <p>[ts] Property 'someFunctionWithAName' does not exist on type 'Interface'.</p>
  </blockquote>
  
  <p>Is there a way to model the Proxy as a type but allow for functions to be added dynamically? All the dynamic functions adhere to the same type definition:</p>
  
  <pre><code>someFunction(): Interface;
  </code></pre>
  
  <p>Other properties and functions of the Proxy might not adhere to this pattern.</p>