JavaScript runtime error: Unable to get property of undefined or null reference.

I randomly get this error when using TypeScript in ASP.NET MVC5 application.

Unhandled exception at line 15, column 5 in http://localhost:2425/theapp/Scripts/app.js?51
0x800a138f - JavaScript runtime error: Unable to get property 'prototype' of undefined or null reference

This is over the following automatically generated JavaScript:

var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};

This is a typical application calling main App.js in _Layout.cshtml as follows:

   <script src="@Url.Content("~/Scripts/app.js?51")"></script>

Turns out that if I manually increment the number after app.js the problem magically disappears. Why? I cannot say at this time…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s