title: How to check instanceof class that is defined within a function?
body: <p>I am trying to export a class that is defined within a function. So, I tried declaring a class export like this:</p>
  <pre class="lang-js prettyprint-override"><code>export declare class GameCameraComponent extends GameObject {
    isMainCamera: boolean;
  }
  
  
  export abstract class GameObject&lt;T extends { new(...args: any[]): any; } = any&gt; { }
  
  // Used for my decorator
  export function Camera(options?: CameraOptions) {
    return function (target: new () =&gt; object) {
      return class GameCameraComponent extends GameObject { 
        instance = new target();
        readonly isMainCamera; // Set in the constructor
      }
    }
  }
  </code></pre>
  <p>No errors are created everything seems fine. Now I want to check somewhere else if the item is an instance of that exported definition like this:</p>
  <pre class="lang-js prettyprint-override"><code>export class CameraService {
    constructor() {
      const cam = Engine.gameObjects.find(o =&gt; o instanceof GameCameraComponent &amp;&amp; o.isMainCamera);
    }
  }
  </code></pre>
  <p>Now at this point, I get the two following errors (I believe this is from webpack as there are no errors in the vscode editor):</p>
  <pre><code>export 'GameCameraComponent' (imported as 'GameCameraComponent') was not found in '../decorators' (possible exports: Camera, GameObject, ObjectChild, ObjectChildren, Path, Prefab)
  </code></pre>
  <p>Next, in the chrome console I get this error:</p>
  <pre><code>Uncaught TypeError: Right-hand side of 'instanceof' is not an object
  </code></pre>
  <p>How can I see if the item is an instanceof the inner function class?</p>