title: Add dynamic getter/setter properties to a function in TypeScript
body: <p>I'm trying add getter/setter properties to a function, TypeScript doesn't complain until I'm trying access that property.</p>
  <pre><code>const obj:{[key:string]:string} = {
    blah: &quot;ok&quot;,
    test: &quot;yes&quot;
  };
  
  const func = (a:string):void =&gt; {};
  
  for(const key in obj)
  {
    Object.defineProperty(func, key, {
      get() { return obj[key]},
      set(a:string) {
        obj[key] = a;
      }
    });
  }
  console.log([func]); //good, shows function and new properties
  console.log(func.blah); //error TS2339: Property 'blah' does not exist on type '(a: string) =&gt; void'.
  </code></pre>
  <p>I'm trying avoid &quot;any&quot; and property names as type declarations.</p>
  <p>Any tips?</p>