Here is an example of code from my Index.ts file, which has a reference to sample.ts:
/// <reference path="sample.ts" />
var s: sample.Calculate = new sample.Calculate(5, 5); -- encountering an error
s.alertme();
This is the content of my Sample.ts file:
module sample {
export class Calculate {
constructor(public x: number, public y: number) {
console.log(x + y);
}
alertme() {
alert('ok');
}
}
}
I am facing an error when calling the calculate function. Here's what it looks like: https://i.sstatic.net/hLq77.png
PS: I am utilizing visual studio 2015. HTML:
@{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<h1>MVC</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more »</a></p>
</div>
<div class="row">
<div class="col-md-4">
</div>
</div>
@section scripts{
<script src="~/Scripts/typings/Index.js"></script>
}