0

Sorry for newbie question on TypeScript.

I started the default TypeScript app on VS2015 and hit run.

I created a very simple class - clsTest with a single public number member. I created the declaration in the Greeter class and create the reference back to the file1.ts where the clsTest is located.

I compiled it and the default application still works (the clock is ticking).

However, as soon as I add the this._obj1 = new clsTest(); (see screen shot in red box), the whole app stops working. Have I done something super obvious? I tried digging for hours without much luck.

Your help is much appreciated.

enter image description here

1
  • Is there any error message you get from VS? Commented Jan 6, 2016 at 7:05

1 Answer 1

0

So, I think - the problem is in your project configuration, if it is default - the compilation result would be two separate JS files with names app.js (which already declared in index.html) and file1.js (I think this one you forgot to declare in index.html);

So, if you would like to compile your code into a single JS file you should look at this topic

Sign up to request clarification or add additional context in comments.

2 Comments

I added the <script src=test.js"></script> before the <script src="app.js"></script> index.html looks like: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>TypeScript HTML App</title> <link rel="stylesheet" href="app.css" type="text/css" /> <script src="test.js"></script> <script src="app.js"></script> </head> <body> <h1>TypeScript HTML App</h1> <div id="content"></div> </body> </html>
Looks like that was the problem. Missing the test.js inside the index.html. BTW, how do I see what is the actual test.js? I can't seem to find that file in my project explorer. Is there a setting that I have to enabled?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.