title: how to get typechecking on dynamic methods?
body: <p>I have a TS object that delegates some actions to another class instance. But since this instance is created at runtime, I'm having trouble getting typechecking on the method calls.
  Something like:</p>
  
  <pre class="lang-js prettyprint-override"><code>
      // main bot class
      class TixBot extends BaseBot implements IBot  {
  
        public actions: BotActions
  
        constructor(room: IRoom) {
          super()
          // based on situation we may delegate to a different actions bot
          this.actions = new TixyActions(this)
        }
  
      }
  
      // class to handle actions varies by bot
      class TixyActions implements BotActions {
  
        public helpText(lang: ILang): string {
          return "something"
        }
      }
  
  </code></pre>
  
  <p>so in other code I have an instance of the TixBot 
  and try to call the <code>actions.helpText()</code> of its internal reference:</p>
  
  <pre class="lang-js prettyprint-override"><code>    tixbotInstance.actions.helpText('en')
  </code></pre>
  
  <p>But I can't get any typechecking on this method.
  The typedefs so far look a bit like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>    //types/index.d.ts
  
      export interface BotActions {
        helpText(lang: ILang): string
      }
  
      export interface IBot {
        actions: IBotActions
  </code></pre>
  
  <p>So is there a way to use casting or type guards or something to allow me to see inside VScode all of the actions?</p>
  
  <p>There is no actual error thrown but just no typechecking or VSCode intellisense on the method.</p>
  
  <p>eg I can type this with no compile time issues, a method that doesn't exist on the dynamic instance.</p>
  
  <pre class="lang-js prettyprint-override"><code>    const introText:string = tixy.actions.foo() // no error!!
  </code></pre>
  
  <p>So <code>tixy.actions</code> even though it's created at runtime, does have a declared type/interface so I would have thought TS would be able to peek in and stop me from typing stupid stuff.</p>