Why not?

```js
var x  = function() {
  function f() : number {
    return 42;
  }
  var y : number = f();
};
```