I am using the following code:

```
$('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top });

```

Typescript is giving me an error message saying:

```
The property 'top' does not exist on value of type 'Object'

```

I am guessing something is missing from the jQuery definition file. Has anyone else seen this problem or is this something that's not normally used with jQuery? It's something I have not seen before.

For more information. Here is the code where this is used:

```
   $.fn.buildTableOfContent = function () {
        "use strict";
        var h2 = this.find('h2');
        if (h2.length > 0) {
            var h1 = this.find('h1:first');
            if (h1.length === 0) {
                h1 = this.prepend('<h1>Help</h1>').children(':first');
            }
            var menu = h1.wrap('<div class="h1 with-menu"></div>')
                    .after('<div class="menu"><img src="/Content/images/menu-open-arrow.png" width="16" height="16"><ul></ul></div>')
                    .next().children('ul');
            h2.each(function (i) {
                this.id = 'step' + i;
                menu.append('<li class="icon_down"><a href="#step' + i + '">' + $(this).html() + '</a></li>');
            });
            menu.find('a').click(function (event) {
                event.preventDefault();
                $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top });
            });
        }
        return this;
    };

```