title: Typescript idioms around adding properties to methods inline with the method definition
body: <p>Are there any idioms in typescript to define properties to methods in a class inline with the method definition?</p>
  
  <p>I'm looking for something similar to .NET attributes.</p>
  
  <p>Here's an example of what I've got so far </p>
  
  <pre><code>class FooController {
      foo(req: express.Request, res: express.Response) {
          res.send(JSON.stringify({ loc: 'FooController::foo 2 here '+req.params.fooId }));
      }
      bar(req: express.Request, res: express.Response) {
          res.send(JSON.stringify({ loc: 'FooController::bar here' }));
      }
  }
  FooController.prototype.foo['route'] = '/foo/:fooId';
  FooController.prototype.foo['verb'] = 'get';
  FooController.prototype.bar['route'] = '/bar';
  FooController.prototype.bar['verb'] = 'post';
  </code></pre>
  
  <p>where a different function will consume FooController and interrogate the method attributes to set up a routing table before any of the FooController methods are invoked.</p>
  
  <p>I don't like the distance between my method definitions and my property definitions, especially as my methods get larger and supporting functions sit in between the two.</p>
  
  <p>Is there anything better I can do here? If there are different language features I should be using to express this other than properties, I'm open to that. I'm especially interested if the solution retains type safety.</p>
  
  <p>I did review <a href="https://stackoverflow.com/questions/12766528/build-a-function-object-with-properties-in-typescript">build a function object with properties in typescript</a> but I don't think the solutions in there are a good match because of the late binding and object method requirements.</p>
  
  <p>I'm using typescript compiler version 1.0.3 with Visual Studio 2013 Update 3.</p>