javascript - fail to start typescript compiled file -
i have converted big js project typescript (as c# programmer) using in phantomjs. problem interpreter (phantomjs) fails while executing js file.
d:\my\phantomjs-1.9.7-windows\phantomjs.exe --load-images=false --ssl-protocol=any --web-security=no --cookies-file=cookies c:\users\alex\projects\robot\bo.js typeerror: 'undefined' not object (evaluating 'b.prototype')
the code is:
var __extends = this.__extends || function (d, b) { (var p in b) if (b.hasownproperty(p)) d[p] = b[p] function __() { this.constructor = d; } __.prototype = b.prototype; // <<< here d.prototype = new __(); };
so. think problem related inheritance. have 1 encountered problem? appreciated. thanks.
the common cause of error loading files in wrong order... example...
file a
class exampleclass { somemethod() { alert('hello world'); } }
file b
class examplesubclass extends exampleclass { }
if load file b
before file a
, exact error describing. (this includes forgetting load file a
or loading file a
after file b
).
fixes
if combining of files single file (and using _references.ts
file) make sure references in right order.
/// <reference path="file-a.ts" /> /// <reference path="file-b.ts" />
if using script tags, similar fix (making sure using .js
extensions , checking order of loading)...
<script src="file-a.js"></script> <script src="file-b.js"></script>
Comments
Post a Comment